
obj/user/forktree.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 be 00 00 00       	call   8000ef <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <forktree>:
	}
}

void
forktree(const char *cur)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	53                   	push   %ebx
  80003b:	83 ec 04             	sub    $0x4,%esp
  80003e:	8b 5d 08             	mov    0x8(%ebp),%ebx
	cprintf("%04x: I am '%s'\n", sys_getenvid(), cur);
  800041:	e8 8d 0b 00 00       	call   800bd3 <sys_getenvid>
  800046:	83 ec 04             	sub    $0x4,%esp
  800049:	53                   	push   %ebx
  80004a:	50                   	push   %eax
  80004b:	68 60 23 80 00       	push   $0x802360
  800050:	e8 a9 01 00 00       	call   8001fe <cprintf>

	forkchild(cur, '0');
  800055:	83 c4 08             	add    $0x8,%esp
  800058:	6a 30                	push   $0x30
  80005a:	53                   	push   %ebx
  80005b:	e8 13 00 00 00       	call   800073 <forkchild>
	forkchild(cur, '1');
  800060:	83 c4 08             	add    $0x8,%esp
  800063:	6a 31                	push   $0x31
  800065:	53                   	push   %ebx
  800066:	e8 08 00 00 00       	call   800073 <forkchild>
}
  80006b:	83 c4 10             	add    $0x10,%esp
  80006e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800071:	c9                   	leave  
  800072:	c3                   	ret    

00800073 <forkchild>:
{
  800073:	f3 0f 1e fb          	endbr32 
  800077:	55                   	push   %ebp
  800078:	89 e5                	mov    %esp,%ebp
  80007a:	56                   	push   %esi
  80007b:	53                   	push   %ebx
  80007c:	83 ec 1c             	sub    $0x1c,%esp
  80007f:	8b 5d 08             	mov    0x8(%ebp),%ebx
  800082:	8b 75 0c             	mov    0xc(%ebp),%esi
	if (strlen(cur) >= DEPTH)
  800085:	53                   	push   %ebx
  800086:	e8 09 07 00 00       	call   800794 <strlen>
  80008b:	83 c4 10             	add    $0x10,%esp
  80008e:	83 f8 02             	cmp    $0x2,%eax
  800091:	7e 07                	jle    80009a <forkchild+0x27>
}
  800093:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800096:	5b                   	pop    %ebx
  800097:	5e                   	pop    %esi
  800098:	5d                   	pop    %ebp
  800099:	c3                   	ret    
	snprintf(nxt, DEPTH+1, "%s%c", cur, branch);
  80009a:	83 ec 0c             	sub    $0xc,%esp
  80009d:	89 f0                	mov    %esi,%eax
  80009f:	0f be f0             	movsbl %al,%esi
  8000a2:	56                   	push   %esi
  8000a3:	53                   	push   %ebx
  8000a4:	68 71 23 80 00       	push   $0x802371
  8000a9:	6a 04                	push   $0x4
  8000ab:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8000ae:	50                   	push   %eax
  8000af:	e8 c2 06 00 00       	call   800776 <snprintf>
	if (fork() == 0) {
  8000b4:	83 c4 20             	add    $0x20,%esp
  8000b7:	e8 94 0e 00 00       	call   800f50 <fork>
  8000bc:	85 c0                	test   %eax,%eax
  8000be:	75 d3                	jne    800093 <forkchild+0x20>
		forktree(nxt);
  8000c0:	83 ec 0c             	sub    $0xc,%esp
  8000c3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8000c6:	50                   	push   %eax
  8000c7:	e8 67 ff ff ff       	call   800033 <forktree>
		exit();
  8000cc:	e8 72 00 00 00       	call   800143 <exit>
  8000d1:	83 c4 10             	add    $0x10,%esp
  8000d4:	eb bd                	jmp    800093 <forkchild+0x20>

008000d6 <umain>:

void
umain(int argc, char **argv)
{
  8000d6:	f3 0f 1e fb          	endbr32 
  8000da:	55                   	push   %ebp
  8000db:	89 e5                	mov    %esp,%ebp
  8000dd:	83 ec 14             	sub    $0x14,%esp
	forktree("");
  8000e0:	68 70 23 80 00       	push   $0x802370
  8000e5:	e8 49 ff ff ff       	call   800033 <forktree>
}
  8000ea:	83 c4 10             	add    $0x10,%esp
  8000ed:	c9                   	leave  
  8000ee:	c3                   	ret    

008000ef <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8000ef:	f3 0f 1e fb          	endbr32 
  8000f3:	55                   	push   %ebp
  8000f4:	89 e5                	mov    %esp,%ebp
  8000f6:	56                   	push   %esi
  8000f7:	53                   	push   %ebx
  8000f8:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8000fb:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8000fe:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  800105:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  800108:	e8 c6 0a 00 00       	call   800bd3 <sys_getenvid>
  80010d:	25 ff 03 00 00       	and    $0x3ff,%eax
  800112:	6b c0 7c             	imul   $0x7c,%eax,%eax
  800115:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  80011a:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  80011f:	85 db                	test   %ebx,%ebx
  800121:	7e 07                	jle    80012a <libmain+0x3b>
		binaryname = argv[0];
  800123:	8b 06                	mov    (%esi),%eax
  800125:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  80012a:	83 ec 08             	sub    $0x8,%esp
  80012d:	56                   	push   %esi
  80012e:	53                   	push   %ebx
  80012f:	e8 a2 ff ff ff       	call   8000d6 <umain>

	// exit gracefully
	exit();
  800134:	e8 0a 00 00 00       	call   800143 <exit>
}
  800139:	83 c4 10             	add    $0x10,%esp
  80013c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80013f:	5b                   	pop    %ebx
  800140:	5e                   	pop    %esi
  800141:	5d                   	pop    %ebp
  800142:	c3                   	ret    

00800143 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  800143:	f3 0f 1e fb          	endbr32 
  800147:	55                   	push   %ebp
  800148:	89 e5                	mov    %esp,%ebp
  80014a:	83 ec 08             	sub    $0x8,%esp
	close_all();
  80014d:	e8 08 12 00 00       	call   80135a <close_all>
	sys_env_destroy(0);
  800152:	83 ec 0c             	sub    $0xc,%esp
  800155:	6a 00                	push   $0x0
  800157:	e8 32 0a 00 00       	call   800b8e <sys_env_destroy>
}
  80015c:	83 c4 10             	add    $0x10,%esp
  80015f:	c9                   	leave  
  800160:	c3                   	ret    

00800161 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  800161:	f3 0f 1e fb          	endbr32 
  800165:	55                   	push   %ebp
  800166:	89 e5                	mov    %esp,%ebp
  800168:	53                   	push   %ebx
  800169:	83 ec 04             	sub    $0x4,%esp
  80016c:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  80016f:	8b 13                	mov    (%ebx),%edx
  800171:	8d 42 01             	lea    0x1(%edx),%eax
  800174:	89 03                	mov    %eax,(%ebx)
  800176:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800179:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  80017d:	3d ff 00 00 00       	cmp    $0xff,%eax
  800182:	74 09                	je     80018d <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  800184:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  800188:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80018b:	c9                   	leave  
  80018c:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  80018d:	83 ec 08             	sub    $0x8,%esp
  800190:	68 ff 00 00 00       	push   $0xff
  800195:	8d 43 08             	lea    0x8(%ebx),%eax
  800198:	50                   	push   %eax
  800199:	e8 ab 09 00 00       	call   800b49 <sys_cputs>
		b->idx = 0;
  80019e:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8001a4:	83 c4 10             	add    $0x10,%esp
  8001a7:	eb db                	jmp    800184 <putch+0x23>

008001a9 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8001a9:	f3 0f 1e fb          	endbr32 
  8001ad:	55                   	push   %ebp
  8001ae:	89 e5                	mov    %esp,%ebp
  8001b0:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  8001b6:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8001bd:	00 00 00 
	b.cnt = 0;
  8001c0:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8001c7:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8001ca:	ff 75 0c             	pushl  0xc(%ebp)
  8001cd:	ff 75 08             	pushl  0x8(%ebp)
  8001d0:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8001d6:	50                   	push   %eax
  8001d7:	68 61 01 80 00       	push   $0x800161
  8001dc:	e8 20 01 00 00       	call   800301 <vprintfmt>
	sys_cputs(b.buf, b.idx);
  8001e1:	83 c4 08             	add    $0x8,%esp
  8001e4:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  8001ea:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  8001f0:	50                   	push   %eax
  8001f1:	e8 53 09 00 00       	call   800b49 <sys_cputs>

	return b.cnt;
}
  8001f6:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  8001fc:	c9                   	leave  
  8001fd:	c3                   	ret    

008001fe <cprintf>:

int
cprintf(const char *fmt, ...)
{
  8001fe:	f3 0f 1e fb          	endbr32 
  800202:	55                   	push   %ebp
  800203:	89 e5                	mov    %esp,%ebp
  800205:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  800208:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  80020b:	50                   	push   %eax
  80020c:	ff 75 08             	pushl  0x8(%ebp)
  80020f:	e8 95 ff ff ff       	call   8001a9 <vcprintf>
	va_end(ap);

	return cnt;
}
  800214:	c9                   	leave  
  800215:	c3                   	ret    

00800216 <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  800216:	55                   	push   %ebp
  800217:	89 e5                	mov    %esp,%ebp
  800219:	57                   	push   %edi
  80021a:	56                   	push   %esi
  80021b:	53                   	push   %ebx
  80021c:	83 ec 1c             	sub    $0x1c,%esp
  80021f:	89 c7                	mov    %eax,%edi
  800221:	89 d6                	mov    %edx,%esi
  800223:	8b 45 08             	mov    0x8(%ebp),%eax
  800226:	8b 55 0c             	mov    0xc(%ebp),%edx
  800229:	89 d1                	mov    %edx,%ecx
  80022b:	89 c2                	mov    %eax,%edx
  80022d:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800230:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800233:	8b 45 10             	mov    0x10(%ebp),%eax
  800236:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800239:	89 45 e0             	mov    %eax,-0x20(%ebp)
  80023c:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  800243:	39 c2                	cmp    %eax,%edx
  800245:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800248:	72 3e                	jb     800288 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  80024a:	83 ec 0c             	sub    $0xc,%esp
  80024d:	ff 75 18             	pushl  0x18(%ebp)
  800250:	83 eb 01             	sub    $0x1,%ebx
  800253:	53                   	push   %ebx
  800254:	50                   	push   %eax
  800255:	83 ec 08             	sub    $0x8,%esp
  800258:	ff 75 e4             	pushl  -0x1c(%ebp)
  80025b:	ff 75 e0             	pushl  -0x20(%ebp)
  80025e:	ff 75 dc             	pushl  -0x24(%ebp)
  800261:	ff 75 d8             	pushl  -0x28(%ebp)
  800264:	e8 97 1e 00 00       	call   802100 <__udivdi3>
  800269:	83 c4 18             	add    $0x18,%esp
  80026c:	52                   	push   %edx
  80026d:	50                   	push   %eax
  80026e:	89 f2                	mov    %esi,%edx
  800270:	89 f8                	mov    %edi,%eax
  800272:	e8 9f ff ff ff       	call   800216 <printnum>
  800277:	83 c4 20             	add    $0x20,%esp
  80027a:	eb 13                	jmp    80028f <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  80027c:	83 ec 08             	sub    $0x8,%esp
  80027f:	56                   	push   %esi
  800280:	ff 75 18             	pushl  0x18(%ebp)
  800283:	ff d7                	call   *%edi
  800285:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  800288:	83 eb 01             	sub    $0x1,%ebx
  80028b:	85 db                	test   %ebx,%ebx
  80028d:	7f ed                	jg     80027c <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  80028f:	83 ec 08             	sub    $0x8,%esp
  800292:	56                   	push   %esi
  800293:	83 ec 04             	sub    $0x4,%esp
  800296:	ff 75 e4             	pushl  -0x1c(%ebp)
  800299:	ff 75 e0             	pushl  -0x20(%ebp)
  80029c:	ff 75 dc             	pushl  -0x24(%ebp)
  80029f:	ff 75 d8             	pushl  -0x28(%ebp)
  8002a2:	e8 69 1f 00 00       	call   802210 <__umoddi3>
  8002a7:	83 c4 14             	add    $0x14,%esp
  8002aa:	0f be 80 80 23 80 00 	movsbl 0x802380(%eax),%eax
  8002b1:	50                   	push   %eax
  8002b2:	ff d7                	call   *%edi
}
  8002b4:	83 c4 10             	add    $0x10,%esp
  8002b7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8002ba:	5b                   	pop    %ebx
  8002bb:	5e                   	pop    %esi
  8002bc:	5f                   	pop    %edi
  8002bd:	5d                   	pop    %ebp
  8002be:	c3                   	ret    

008002bf <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8002bf:	f3 0f 1e fb          	endbr32 
  8002c3:	55                   	push   %ebp
  8002c4:	89 e5                	mov    %esp,%ebp
  8002c6:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8002c9:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8002cd:	8b 10                	mov    (%eax),%edx
  8002cf:	3b 50 04             	cmp    0x4(%eax),%edx
  8002d2:	73 0a                	jae    8002de <sprintputch+0x1f>
		*b->buf++ = ch;
  8002d4:	8d 4a 01             	lea    0x1(%edx),%ecx
  8002d7:	89 08                	mov    %ecx,(%eax)
  8002d9:	8b 45 08             	mov    0x8(%ebp),%eax
  8002dc:	88 02                	mov    %al,(%edx)
}
  8002de:	5d                   	pop    %ebp
  8002df:	c3                   	ret    

008002e0 <printfmt>:
{
  8002e0:	f3 0f 1e fb          	endbr32 
  8002e4:	55                   	push   %ebp
  8002e5:	89 e5                	mov    %esp,%ebp
  8002e7:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  8002ea:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  8002ed:	50                   	push   %eax
  8002ee:	ff 75 10             	pushl  0x10(%ebp)
  8002f1:	ff 75 0c             	pushl  0xc(%ebp)
  8002f4:	ff 75 08             	pushl  0x8(%ebp)
  8002f7:	e8 05 00 00 00       	call   800301 <vprintfmt>
}
  8002fc:	83 c4 10             	add    $0x10,%esp
  8002ff:	c9                   	leave  
  800300:	c3                   	ret    

00800301 <vprintfmt>:
{
  800301:	f3 0f 1e fb          	endbr32 
  800305:	55                   	push   %ebp
  800306:	89 e5                	mov    %esp,%ebp
  800308:	57                   	push   %edi
  800309:	56                   	push   %esi
  80030a:	53                   	push   %ebx
  80030b:	83 ec 3c             	sub    $0x3c,%esp
  80030e:	8b 75 08             	mov    0x8(%ebp),%esi
  800311:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  800314:	8b 7d 10             	mov    0x10(%ebp),%edi
  800317:	e9 5d 03 00 00       	jmp    800679 <vprintfmt+0x378>
		padc = ' ';
  80031c:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800320:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800327:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  80032e:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  800335:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  80033a:	8d 47 01             	lea    0x1(%edi),%eax
  80033d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800340:	0f b6 17             	movzbl (%edi),%edx
  800343:	8d 42 dd             	lea    -0x23(%edx),%eax
  800346:	3c 55                	cmp    $0x55,%al
  800348:	0f 87 ae 03 00 00    	ja     8006fc <vprintfmt+0x3fb>
  80034e:	0f b6 c0             	movzbl %al,%eax
  800351:	3e ff 24 85 c0 24 80 	notrack jmp *0x8024c0(,%eax,4)
  800358:	00 
  800359:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  80035c:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800360:	eb d8                	jmp    80033a <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  800362:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  800365:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800369:	eb cf                	jmp    80033a <vprintfmt+0x39>
  80036b:	0f b6 d2             	movzbl %dl,%edx
  80036e:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  800371:	b8 00 00 00 00       	mov    $0x0,%eax
  800376:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  800379:	8d 04 80             	lea    (%eax,%eax,4),%eax
  80037c:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  800380:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  800383:	8d 4a d0             	lea    -0x30(%edx),%ecx
  800386:	83 f9 09             	cmp    $0x9,%ecx
  800389:	77 55                	ja     8003e0 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  80038b:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  80038e:	eb e9                	jmp    800379 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  800390:	8b 45 14             	mov    0x14(%ebp),%eax
  800393:	8b 00                	mov    (%eax),%eax
  800395:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800398:	8b 45 14             	mov    0x14(%ebp),%eax
  80039b:	8d 40 04             	lea    0x4(%eax),%eax
  80039e:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003a1:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8003a4:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8003a8:	79 90                	jns    80033a <vprintfmt+0x39>
				width = precision, precision = -1;
  8003aa:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8003ad:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8003b0:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  8003b7:	eb 81                	jmp    80033a <vprintfmt+0x39>
  8003b9:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8003bc:	85 c0                	test   %eax,%eax
  8003be:	ba 00 00 00 00       	mov    $0x0,%edx
  8003c3:	0f 49 d0             	cmovns %eax,%edx
  8003c6:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003c9:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003cc:	e9 69 ff ff ff       	jmp    80033a <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8003d1:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8003d4:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  8003db:	e9 5a ff ff ff       	jmp    80033a <vprintfmt+0x39>
  8003e0:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  8003e3:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003e6:	eb bc                	jmp    8003a4 <vprintfmt+0xa3>
			lflag++;
  8003e8:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8003eb:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003ee:	e9 47 ff ff ff       	jmp    80033a <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  8003f3:	8b 45 14             	mov    0x14(%ebp),%eax
  8003f6:	8d 78 04             	lea    0x4(%eax),%edi
  8003f9:	83 ec 08             	sub    $0x8,%esp
  8003fc:	53                   	push   %ebx
  8003fd:	ff 30                	pushl  (%eax)
  8003ff:	ff d6                	call   *%esi
			break;
  800401:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  800404:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  800407:	e9 6a 02 00 00       	jmp    800676 <vprintfmt+0x375>
			err = va_arg(ap, int);
  80040c:	8b 45 14             	mov    0x14(%ebp),%eax
  80040f:	8d 78 04             	lea    0x4(%eax),%edi
  800412:	8b 00                	mov    (%eax),%eax
  800414:	99                   	cltd   
  800415:	31 d0                	xor    %edx,%eax
  800417:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  800419:	83 f8 0f             	cmp    $0xf,%eax
  80041c:	7f 23                	jg     800441 <vprintfmt+0x140>
  80041e:	8b 14 85 20 26 80 00 	mov    0x802620(,%eax,4),%edx
  800425:	85 d2                	test   %edx,%edx
  800427:	74 18                	je     800441 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800429:	52                   	push   %edx
  80042a:	68 a1 28 80 00       	push   $0x8028a1
  80042f:	53                   	push   %ebx
  800430:	56                   	push   %esi
  800431:	e8 aa fe ff ff       	call   8002e0 <printfmt>
  800436:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800439:	89 7d 14             	mov    %edi,0x14(%ebp)
  80043c:	e9 35 02 00 00       	jmp    800676 <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  800441:	50                   	push   %eax
  800442:	68 98 23 80 00       	push   $0x802398
  800447:	53                   	push   %ebx
  800448:	56                   	push   %esi
  800449:	e8 92 fe ff ff       	call   8002e0 <printfmt>
  80044e:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800451:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  800454:	e9 1d 02 00 00       	jmp    800676 <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800459:	8b 45 14             	mov    0x14(%ebp),%eax
  80045c:	83 c0 04             	add    $0x4,%eax
  80045f:	89 45 c8             	mov    %eax,-0x38(%ebp)
  800462:	8b 45 14             	mov    0x14(%ebp),%eax
  800465:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800467:	85 d2                	test   %edx,%edx
  800469:	b8 91 23 80 00       	mov    $0x802391,%eax
  80046e:	0f 45 c2             	cmovne %edx,%eax
  800471:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  800474:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800478:	7e 06                	jle    800480 <vprintfmt+0x17f>
  80047a:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  80047e:	75 0d                	jne    80048d <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  800480:	8b 45 cc             	mov    -0x34(%ebp),%eax
  800483:	89 c7                	mov    %eax,%edi
  800485:	03 45 d4             	add    -0x2c(%ebp),%eax
  800488:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  80048b:	eb 55                	jmp    8004e2 <vprintfmt+0x1e1>
  80048d:	83 ec 08             	sub    $0x8,%esp
  800490:	ff 75 d8             	pushl  -0x28(%ebp)
  800493:	ff 75 cc             	pushl  -0x34(%ebp)
  800496:	e8 15 03 00 00       	call   8007b0 <strnlen>
  80049b:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  80049e:	29 c2                	sub    %eax,%edx
  8004a0:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8004a3:	83 c4 10             	add    $0x10,%esp
  8004a6:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8004a8:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8004ac:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8004af:	85 ff                	test   %edi,%edi
  8004b1:	7e 11                	jle    8004c4 <vprintfmt+0x1c3>
					putch(padc, putdat);
  8004b3:	83 ec 08             	sub    $0x8,%esp
  8004b6:	53                   	push   %ebx
  8004b7:	ff 75 d4             	pushl  -0x2c(%ebp)
  8004ba:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  8004bc:	83 ef 01             	sub    $0x1,%edi
  8004bf:	83 c4 10             	add    $0x10,%esp
  8004c2:	eb eb                	jmp    8004af <vprintfmt+0x1ae>
  8004c4:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8004c7:	85 d2                	test   %edx,%edx
  8004c9:	b8 00 00 00 00       	mov    $0x0,%eax
  8004ce:	0f 49 c2             	cmovns %edx,%eax
  8004d1:	29 c2                	sub    %eax,%edx
  8004d3:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8004d6:	eb a8                	jmp    800480 <vprintfmt+0x17f>
					putch(ch, putdat);
  8004d8:	83 ec 08             	sub    $0x8,%esp
  8004db:	53                   	push   %ebx
  8004dc:	52                   	push   %edx
  8004dd:	ff d6                	call   *%esi
  8004df:	83 c4 10             	add    $0x10,%esp
  8004e2:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  8004e5:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8004e7:	83 c7 01             	add    $0x1,%edi
  8004ea:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8004ee:	0f be d0             	movsbl %al,%edx
  8004f1:	85 d2                	test   %edx,%edx
  8004f3:	74 4b                	je     800540 <vprintfmt+0x23f>
  8004f5:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  8004f9:	78 06                	js     800501 <vprintfmt+0x200>
  8004fb:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  8004ff:	78 1e                	js     80051f <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  800501:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  800505:	74 d1                	je     8004d8 <vprintfmt+0x1d7>
  800507:	0f be c0             	movsbl %al,%eax
  80050a:	83 e8 20             	sub    $0x20,%eax
  80050d:	83 f8 5e             	cmp    $0x5e,%eax
  800510:	76 c6                	jbe    8004d8 <vprintfmt+0x1d7>
					putch('?', putdat);
  800512:	83 ec 08             	sub    $0x8,%esp
  800515:	53                   	push   %ebx
  800516:	6a 3f                	push   $0x3f
  800518:	ff d6                	call   *%esi
  80051a:	83 c4 10             	add    $0x10,%esp
  80051d:	eb c3                	jmp    8004e2 <vprintfmt+0x1e1>
  80051f:	89 cf                	mov    %ecx,%edi
  800521:	eb 0e                	jmp    800531 <vprintfmt+0x230>
				putch(' ', putdat);
  800523:	83 ec 08             	sub    $0x8,%esp
  800526:	53                   	push   %ebx
  800527:	6a 20                	push   $0x20
  800529:	ff d6                	call   *%esi
			for (; width > 0; width--)
  80052b:	83 ef 01             	sub    $0x1,%edi
  80052e:	83 c4 10             	add    $0x10,%esp
  800531:	85 ff                	test   %edi,%edi
  800533:	7f ee                	jg     800523 <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  800535:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800538:	89 45 14             	mov    %eax,0x14(%ebp)
  80053b:	e9 36 01 00 00       	jmp    800676 <vprintfmt+0x375>
  800540:	89 cf                	mov    %ecx,%edi
  800542:	eb ed                	jmp    800531 <vprintfmt+0x230>
	if (lflag >= 2)
  800544:	83 f9 01             	cmp    $0x1,%ecx
  800547:	7f 1f                	jg     800568 <vprintfmt+0x267>
	else if (lflag)
  800549:	85 c9                	test   %ecx,%ecx
  80054b:	74 67                	je     8005b4 <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  80054d:	8b 45 14             	mov    0x14(%ebp),%eax
  800550:	8b 00                	mov    (%eax),%eax
  800552:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800555:	89 c1                	mov    %eax,%ecx
  800557:	c1 f9 1f             	sar    $0x1f,%ecx
  80055a:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80055d:	8b 45 14             	mov    0x14(%ebp),%eax
  800560:	8d 40 04             	lea    0x4(%eax),%eax
  800563:	89 45 14             	mov    %eax,0x14(%ebp)
  800566:	eb 17                	jmp    80057f <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800568:	8b 45 14             	mov    0x14(%ebp),%eax
  80056b:	8b 50 04             	mov    0x4(%eax),%edx
  80056e:	8b 00                	mov    (%eax),%eax
  800570:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800573:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800576:	8b 45 14             	mov    0x14(%ebp),%eax
  800579:	8d 40 08             	lea    0x8(%eax),%eax
  80057c:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  80057f:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800582:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  800585:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  80058a:	85 c9                	test   %ecx,%ecx
  80058c:	0f 89 ca 00 00 00    	jns    80065c <vprintfmt+0x35b>
				putch('-', putdat);
  800592:	83 ec 08             	sub    $0x8,%esp
  800595:	53                   	push   %ebx
  800596:	6a 2d                	push   $0x2d
  800598:	ff d6                	call   *%esi
				num = -(long long) num;
  80059a:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80059d:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8005a0:	f7 da                	neg    %edx
  8005a2:	83 d1 00             	adc    $0x0,%ecx
  8005a5:	f7 d9                	neg    %ecx
  8005a7:	83 c4 10             	add    $0x10,%esp
			base = 10;
  8005aa:	b8 0a 00 00 00       	mov    $0xa,%eax
  8005af:	e9 a8 00 00 00       	jmp    80065c <vprintfmt+0x35b>
		return va_arg(*ap, int);
  8005b4:	8b 45 14             	mov    0x14(%ebp),%eax
  8005b7:	8b 00                	mov    (%eax),%eax
  8005b9:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005bc:	99                   	cltd   
  8005bd:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8005c0:	8b 45 14             	mov    0x14(%ebp),%eax
  8005c3:	8d 40 04             	lea    0x4(%eax),%eax
  8005c6:	89 45 14             	mov    %eax,0x14(%ebp)
  8005c9:	eb b4                	jmp    80057f <vprintfmt+0x27e>
	if (lflag >= 2)
  8005cb:	83 f9 01             	cmp    $0x1,%ecx
  8005ce:	7f 1b                	jg     8005eb <vprintfmt+0x2ea>
	else if (lflag)
  8005d0:	85 c9                	test   %ecx,%ecx
  8005d2:	74 2c                	je     800600 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  8005d4:	8b 45 14             	mov    0x14(%ebp),%eax
  8005d7:	8b 10                	mov    (%eax),%edx
  8005d9:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005de:	8d 40 04             	lea    0x4(%eax),%eax
  8005e1:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005e4:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  8005e9:	eb 71                	jmp    80065c <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8005eb:	8b 45 14             	mov    0x14(%ebp),%eax
  8005ee:	8b 10                	mov    (%eax),%edx
  8005f0:	8b 48 04             	mov    0x4(%eax),%ecx
  8005f3:	8d 40 08             	lea    0x8(%eax),%eax
  8005f6:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005f9:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  8005fe:	eb 5c                	jmp    80065c <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800600:	8b 45 14             	mov    0x14(%ebp),%eax
  800603:	8b 10                	mov    (%eax),%edx
  800605:	b9 00 00 00 00       	mov    $0x0,%ecx
  80060a:	8d 40 04             	lea    0x4(%eax),%eax
  80060d:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800610:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  800615:	eb 45                	jmp    80065c <vprintfmt+0x35b>
			putch('X', putdat);
  800617:	83 ec 08             	sub    $0x8,%esp
  80061a:	53                   	push   %ebx
  80061b:	6a 58                	push   $0x58
  80061d:	ff d6                	call   *%esi
			putch('X', putdat);
  80061f:	83 c4 08             	add    $0x8,%esp
  800622:	53                   	push   %ebx
  800623:	6a 58                	push   $0x58
  800625:	ff d6                	call   *%esi
			putch('X', putdat);
  800627:	83 c4 08             	add    $0x8,%esp
  80062a:	53                   	push   %ebx
  80062b:	6a 58                	push   $0x58
  80062d:	ff d6                	call   *%esi
			break;
  80062f:	83 c4 10             	add    $0x10,%esp
  800632:	eb 42                	jmp    800676 <vprintfmt+0x375>
			putch('0', putdat);
  800634:	83 ec 08             	sub    $0x8,%esp
  800637:	53                   	push   %ebx
  800638:	6a 30                	push   $0x30
  80063a:	ff d6                	call   *%esi
			putch('x', putdat);
  80063c:	83 c4 08             	add    $0x8,%esp
  80063f:	53                   	push   %ebx
  800640:	6a 78                	push   $0x78
  800642:	ff d6                	call   *%esi
			num = (unsigned long long)
  800644:	8b 45 14             	mov    0x14(%ebp),%eax
  800647:	8b 10                	mov    (%eax),%edx
  800649:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  80064e:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  800651:	8d 40 04             	lea    0x4(%eax),%eax
  800654:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800657:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  80065c:	83 ec 0c             	sub    $0xc,%esp
  80065f:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  800663:	57                   	push   %edi
  800664:	ff 75 d4             	pushl  -0x2c(%ebp)
  800667:	50                   	push   %eax
  800668:	51                   	push   %ecx
  800669:	52                   	push   %edx
  80066a:	89 da                	mov    %ebx,%edx
  80066c:	89 f0                	mov    %esi,%eax
  80066e:	e8 a3 fb ff ff       	call   800216 <printnum>
			break;
  800673:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  800676:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800679:	83 c7 01             	add    $0x1,%edi
  80067c:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800680:	83 f8 25             	cmp    $0x25,%eax
  800683:	0f 84 93 fc ff ff    	je     80031c <vprintfmt+0x1b>
			if (ch == '\0')
  800689:	85 c0                	test   %eax,%eax
  80068b:	0f 84 8b 00 00 00    	je     80071c <vprintfmt+0x41b>
			putch(ch, putdat);
  800691:	83 ec 08             	sub    $0x8,%esp
  800694:	53                   	push   %ebx
  800695:	50                   	push   %eax
  800696:	ff d6                	call   *%esi
  800698:	83 c4 10             	add    $0x10,%esp
  80069b:	eb dc                	jmp    800679 <vprintfmt+0x378>
	if (lflag >= 2)
  80069d:	83 f9 01             	cmp    $0x1,%ecx
  8006a0:	7f 1b                	jg     8006bd <vprintfmt+0x3bc>
	else if (lflag)
  8006a2:	85 c9                	test   %ecx,%ecx
  8006a4:	74 2c                	je     8006d2 <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8006a6:	8b 45 14             	mov    0x14(%ebp),%eax
  8006a9:	8b 10                	mov    (%eax),%edx
  8006ab:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006b0:	8d 40 04             	lea    0x4(%eax),%eax
  8006b3:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006b6:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  8006bb:	eb 9f                	jmp    80065c <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8006bd:	8b 45 14             	mov    0x14(%ebp),%eax
  8006c0:	8b 10                	mov    (%eax),%edx
  8006c2:	8b 48 04             	mov    0x4(%eax),%ecx
  8006c5:	8d 40 08             	lea    0x8(%eax),%eax
  8006c8:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006cb:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8006d0:	eb 8a                	jmp    80065c <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8006d2:	8b 45 14             	mov    0x14(%ebp),%eax
  8006d5:	8b 10                	mov    (%eax),%edx
  8006d7:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006dc:	8d 40 04             	lea    0x4(%eax),%eax
  8006df:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006e2:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  8006e7:	e9 70 ff ff ff       	jmp    80065c <vprintfmt+0x35b>
			putch(ch, putdat);
  8006ec:	83 ec 08             	sub    $0x8,%esp
  8006ef:	53                   	push   %ebx
  8006f0:	6a 25                	push   $0x25
  8006f2:	ff d6                	call   *%esi
			break;
  8006f4:	83 c4 10             	add    $0x10,%esp
  8006f7:	e9 7a ff ff ff       	jmp    800676 <vprintfmt+0x375>
			putch('%', putdat);
  8006fc:	83 ec 08             	sub    $0x8,%esp
  8006ff:	53                   	push   %ebx
  800700:	6a 25                	push   $0x25
  800702:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  800704:	83 c4 10             	add    $0x10,%esp
  800707:	89 f8                	mov    %edi,%eax
  800709:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  80070d:	74 05                	je     800714 <vprintfmt+0x413>
  80070f:	83 e8 01             	sub    $0x1,%eax
  800712:	eb f5                	jmp    800709 <vprintfmt+0x408>
  800714:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800717:	e9 5a ff ff ff       	jmp    800676 <vprintfmt+0x375>
}
  80071c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80071f:	5b                   	pop    %ebx
  800720:	5e                   	pop    %esi
  800721:	5f                   	pop    %edi
  800722:	5d                   	pop    %ebp
  800723:	c3                   	ret    

00800724 <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  800724:	f3 0f 1e fb          	endbr32 
  800728:	55                   	push   %ebp
  800729:	89 e5                	mov    %esp,%ebp
  80072b:	83 ec 18             	sub    $0x18,%esp
  80072e:	8b 45 08             	mov    0x8(%ebp),%eax
  800731:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  800734:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800737:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  80073b:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  80073e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  800745:	85 c0                	test   %eax,%eax
  800747:	74 26                	je     80076f <vsnprintf+0x4b>
  800749:	85 d2                	test   %edx,%edx
  80074b:	7e 22                	jle    80076f <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  80074d:	ff 75 14             	pushl  0x14(%ebp)
  800750:	ff 75 10             	pushl  0x10(%ebp)
  800753:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800756:	50                   	push   %eax
  800757:	68 bf 02 80 00       	push   $0x8002bf
  80075c:	e8 a0 fb ff ff       	call   800301 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  800761:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800764:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800767:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80076a:	83 c4 10             	add    $0x10,%esp
}
  80076d:	c9                   	leave  
  80076e:	c3                   	ret    
		return -E_INVAL;
  80076f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800774:	eb f7                	jmp    80076d <vsnprintf+0x49>

00800776 <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  800776:	f3 0f 1e fb          	endbr32 
  80077a:	55                   	push   %ebp
  80077b:	89 e5                	mov    %esp,%ebp
  80077d:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800780:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  800783:	50                   	push   %eax
  800784:	ff 75 10             	pushl  0x10(%ebp)
  800787:	ff 75 0c             	pushl  0xc(%ebp)
  80078a:	ff 75 08             	pushl  0x8(%ebp)
  80078d:	e8 92 ff ff ff       	call   800724 <vsnprintf>
	va_end(ap);

	return rc;
}
  800792:	c9                   	leave  
  800793:	c3                   	ret    

00800794 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  800794:	f3 0f 1e fb          	endbr32 
  800798:	55                   	push   %ebp
  800799:	89 e5                	mov    %esp,%ebp
  80079b:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  80079e:	b8 00 00 00 00       	mov    $0x0,%eax
  8007a3:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8007a7:	74 05                	je     8007ae <strlen+0x1a>
		n++;
  8007a9:	83 c0 01             	add    $0x1,%eax
  8007ac:	eb f5                	jmp    8007a3 <strlen+0xf>
	return n;
}
  8007ae:	5d                   	pop    %ebp
  8007af:	c3                   	ret    

008007b0 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8007b0:	f3 0f 1e fb          	endbr32 
  8007b4:	55                   	push   %ebp
  8007b5:	89 e5                	mov    %esp,%ebp
  8007b7:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007ba:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8007bd:	b8 00 00 00 00       	mov    $0x0,%eax
  8007c2:	39 d0                	cmp    %edx,%eax
  8007c4:	74 0d                	je     8007d3 <strnlen+0x23>
  8007c6:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  8007ca:	74 05                	je     8007d1 <strnlen+0x21>
		n++;
  8007cc:	83 c0 01             	add    $0x1,%eax
  8007cf:	eb f1                	jmp    8007c2 <strnlen+0x12>
  8007d1:	89 c2                	mov    %eax,%edx
	return n;
}
  8007d3:	89 d0                	mov    %edx,%eax
  8007d5:	5d                   	pop    %ebp
  8007d6:	c3                   	ret    

008007d7 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  8007d7:	f3 0f 1e fb          	endbr32 
  8007db:	55                   	push   %ebp
  8007dc:	89 e5                	mov    %esp,%ebp
  8007de:	53                   	push   %ebx
  8007df:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007e2:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  8007e5:	b8 00 00 00 00       	mov    $0x0,%eax
  8007ea:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  8007ee:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  8007f1:	83 c0 01             	add    $0x1,%eax
  8007f4:	84 d2                	test   %dl,%dl
  8007f6:	75 f2                	jne    8007ea <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  8007f8:	89 c8                	mov    %ecx,%eax
  8007fa:	5b                   	pop    %ebx
  8007fb:	5d                   	pop    %ebp
  8007fc:	c3                   	ret    

008007fd <strcat>:

char *
strcat(char *dst, const char *src)
{
  8007fd:	f3 0f 1e fb          	endbr32 
  800801:	55                   	push   %ebp
  800802:	89 e5                	mov    %esp,%ebp
  800804:	53                   	push   %ebx
  800805:	83 ec 10             	sub    $0x10,%esp
  800808:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  80080b:	53                   	push   %ebx
  80080c:	e8 83 ff ff ff       	call   800794 <strlen>
  800811:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  800814:	ff 75 0c             	pushl  0xc(%ebp)
  800817:	01 d8                	add    %ebx,%eax
  800819:	50                   	push   %eax
  80081a:	e8 b8 ff ff ff       	call   8007d7 <strcpy>
	return dst;
}
  80081f:	89 d8                	mov    %ebx,%eax
  800821:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800824:	c9                   	leave  
  800825:	c3                   	ret    

00800826 <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  800826:	f3 0f 1e fb          	endbr32 
  80082a:	55                   	push   %ebp
  80082b:	89 e5                	mov    %esp,%ebp
  80082d:	56                   	push   %esi
  80082e:	53                   	push   %ebx
  80082f:	8b 75 08             	mov    0x8(%ebp),%esi
  800832:	8b 55 0c             	mov    0xc(%ebp),%edx
  800835:	89 f3                	mov    %esi,%ebx
  800837:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  80083a:	89 f0                	mov    %esi,%eax
  80083c:	39 d8                	cmp    %ebx,%eax
  80083e:	74 11                	je     800851 <strncpy+0x2b>
		*dst++ = *src;
  800840:	83 c0 01             	add    $0x1,%eax
  800843:	0f b6 0a             	movzbl (%edx),%ecx
  800846:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800849:	80 f9 01             	cmp    $0x1,%cl
  80084c:	83 da ff             	sbb    $0xffffffff,%edx
  80084f:	eb eb                	jmp    80083c <strncpy+0x16>
	}
	return ret;
}
  800851:	89 f0                	mov    %esi,%eax
  800853:	5b                   	pop    %ebx
  800854:	5e                   	pop    %esi
  800855:	5d                   	pop    %ebp
  800856:	c3                   	ret    

00800857 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800857:	f3 0f 1e fb          	endbr32 
  80085b:	55                   	push   %ebp
  80085c:	89 e5                	mov    %esp,%ebp
  80085e:	56                   	push   %esi
  80085f:	53                   	push   %ebx
  800860:	8b 75 08             	mov    0x8(%ebp),%esi
  800863:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800866:	8b 55 10             	mov    0x10(%ebp),%edx
  800869:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  80086b:	85 d2                	test   %edx,%edx
  80086d:	74 21                	je     800890 <strlcpy+0x39>
  80086f:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  800873:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  800875:	39 c2                	cmp    %eax,%edx
  800877:	74 14                	je     80088d <strlcpy+0x36>
  800879:	0f b6 19             	movzbl (%ecx),%ebx
  80087c:	84 db                	test   %bl,%bl
  80087e:	74 0b                	je     80088b <strlcpy+0x34>
			*dst++ = *src++;
  800880:	83 c1 01             	add    $0x1,%ecx
  800883:	83 c2 01             	add    $0x1,%edx
  800886:	88 5a ff             	mov    %bl,-0x1(%edx)
  800889:	eb ea                	jmp    800875 <strlcpy+0x1e>
  80088b:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  80088d:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  800890:	29 f0                	sub    %esi,%eax
}
  800892:	5b                   	pop    %ebx
  800893:	5e                   	pop    %esi
  800894:	5d                   	pop    %ebp
  800895:	c3                   	ret    

00800896 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  800896:	f3 0f 1e fb          	endbr32 
  80089a:	55                   	push   %ebp
  80089b:	89 e5                	mov    %esp,%ebp
  80089d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008a0:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8008a3:	0f b6 01             	movzbl (%ecx),%eax
  8008a6:	84 c0                	test   %al,%al
  8008a8:	74 0c                	je     8008b6 <strcmp+0x20>
  8008aa:	3a 02                	cmp    (%edx),%al
  8008ac:	75 08                	jne    8008b6 <strcmp+0x20>
		p++, q++;
  8008ae:	83 c1 01             	add    $0x1,%ecx
  8008b1:	83 c2 01             	add    $0x1,%edx
  8008b4:	eb ed                	jmp    8008a3 <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  8008b6:	0f b6 c0             	movzbl %al,%eax
  8008b9:	0f b6 12             	movzbl (%edx),%edx
  8008bc:	29 d0                	sub    %edx,%eax
}
  8008be:	5d                   	pop    %ebp
  8008bf:	c3                   	ret    

008008c0 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  8008c0:	f3 0f 1e fb          	endbr32 
  8008c4:	55                   	push   %ebp
  8008c5:	89 e5                	mov    %esp,%ebp
  8008c7:	53                   	push   %ebx
  8008c8:	8b 45 08             	mov    0x8(%ebp),%eax
  8008cb:	8b 55 0c             	mov    0xc(%ebp),%edx
  8008ce:	89 c3                	mov    %eax,%ebx
  8008d0:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  8008d3:	eb 06                	jmp    8008db <strncmp+0x1b>
		n--, p++, q++;
  8008d5:	83 c0 01             	add    $0x1,%eax
  8008d8:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  8008db:	39 d8                	cmp    %ebx,%eax
  8008dd:	74 16                	je     8008f5 <strncmp+0x35>
  8008df:	0f b6 08             	movzbl (%eax),%ecx
  8008e2:	84 c9                	test   %cl,%cl
  8008e4:	74 04                	je     8008ea <strncmp+0x2a>
  8008e6:	3a 0a                	cmp    (%edx),%cl
  8008e8:	74 eb                	je     8008d5 <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  8008ea:	0f b6 00             	movzbl (%eax),%eax
  8008ed:	0f b6 12             	movzbl (%edx),%edx
  8008f0:	29 d0                	sub    %edx,%eax
}
  8008f2:	5b                   	pop    %ebx
  8008f3:	5d                   	pop    %ebp
  8008f4:	c3                   	ret    
		return 0;
  8008f5:	b8 00 00 00 00       	mov    $0x0,%eax
  8008fa:	eb f6                	jmp    8008f2 <strncmp+0x32>

008008fc <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  8008fc:	f3 0f 1e fb          	endbr32 
  800900:	55                   	push   %ebp
  800901:	89 e5                	mov    %esp,%ebp
  800903:	8b 45 08             	mov    0x8(%ebp),%eax
  800906:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  80090a:	0f b6 10             	movzbl (%eax),%edx
  80090d:	84 d2                	test   %dl,%dl
  80090f:	74 09                	je     80091a <strchr+0x1e>
		if (*s == c)
  800911:	38 ca                	cmp    %cl,%dl
  800913:	74 0a                	je     80091f <strchr+0x23>
	for (; *s; s++)
  800915:	83 c0 01             	add    $0x1,%eax
  800918:	eb f0                	jmp    80090a <strchr+0xe>
			return (char *) s;
	return 0;
  80091a:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80091f:	5d                   	pop    %ebp
  800920:	c3                   	ret    

00800921 <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800921:	f3 0f 1e fb          	endbr32 
  800925:	55                   	push   %ebp
  800926:	89 e5                	mov    %esp,%ebp
  800928:	8b 45 08             	mov    0x8(%ebp),%eax
  80092b:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  80092f:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800932:	38 ca                	cmp    %cl,%dl
  800934:	74 09                	je     80093f <strfind+0x1e>
  800936:	84 d2                	test   %dl,%dl
  800938:	74 05                	je     80093f <strfind+0x1e>
	for (; *s; s++)
  80093a:	83 c0 01             	add    $0x1,%eax
  80093d:	eb f0                	jmp    80092f <strfind+0xe>
			break;
	return (char *) s;
}
  80093f:	5d                   	pop    %ebp
  800940:	c3                   	ret    

00800941 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800941:	f3 0f 1e fb          	endbr32 
  800945:	55                   	push   %ebp
  800946:	89 e5                	mov    %esp,%ebp
  800948:	57                   	push   %edi
  800949:	56                   	push   %esi
  80094a:	53                   	push   %ebx
  80094b:	8b 7d 08             	mov    0x8(%ebp),%edi
  80094e:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800951:	85 c9                	test   %ecx,%ecx
  800953:	74 31                	je     800986 <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800955:	89 f8                	mov    %edi,%eax
  800957:	09 c8                	or     %ecx,%eax
  800959:	a8 03                	test   $0x3,%al
  80095b:	75 23                	jne    800980 <memset+0x3f>
		c &= 0xFF;
  80095d:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800961:	89 d3                	mov    %edx,%ebx
  800963:	c1 e3 08             	shl    $0x8,%ebx
  800966:	89 d0                	mov    %edx,%eax
  800968:	c1 e0 18             	shl    $0x18,%eax
  80096b:	89 d6                	mov    %edx,%esi
  80096d:	c1 e6 10             	shl    $0x10,%esi
  800970:	09 f0                	or     %esi,%eax
  800972:	09 c2                	or     %eax,%edx
  800974:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800976:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800979:	89 d0                	mov    %edx,%eax
  80097b:	fc                   	cld    
  80097c:	f3 ab                	rep stos %eax,%es:(%edi)
  80097e:	eb 06                	jmp    800986 <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800980:	8b 45 0c             	mov    0xc(%ebp),%eax
  800983:	fc                   	cld    
  800984:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800986:	89 f8                	mov    %edi,%eax
  800988:	5b                   	pop    %ebx
  800989:	5e                   	pop    %esi
  80098a:	5f                   	pop    %edi
  80098b:	5d                   	pop    %ebp
  80098c:	c3                   	ret    

0080098d <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  80098d:	f3 0f 1e fb          	endbr32 
  800991:	55                   	push   %ebp
  800992:	89 e5                	mov    %esp,%ebp
  800994:	57                   	push   %edi
  800995:	56                   	push   %esi
  800996:	8b 45 08             	mov    0x8(%ebp),%eax
  800999:	8b 75 0c             	mov    0xc(%ebp),%esi
  80099c:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  80099f:	39 c6                	cmp    %eax,%esi
  8009a1:	73 32                	jae    8009d5 <memmove+0x48>
  8009a3:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  8009a6:	39 c2                	cmp    %eax,%edx
  8009a8:	76 2b                	jbe    8009d5 <memmove+0x48>
		s += n;
		d += n;
  8009aa:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009ad:	89 fe                	mov    %edi,%esi
  8009af:	09 ce                	or     %ecx,%esi
  8009b1:	09 d6                	or     %edx,%esi
  8009b3:	f7 c6 03 00 00 00    	test   $0x3,%esi
  8009b9:	75 0e                	jne    8009c9 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  8009bb:	83 ef 04             	sub    $0x4,%edi
  8009be:	8d 72 fc             	lea    -0x4(%edx),%esi
  8009c1:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  8009c4:	fd                   	std    
  8009c5:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8009c7:	eb 09                	jmp    8009d2 <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  8009c9:	83 ef 01             	sub    $0x1,%edi
  8009cc:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  8009cf:	fd                   	std    
  8009d0:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  8009d2:	fc                   	cld    
  8009d3:	eb 1a                	jmp    8009ef <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009d5:	89 c2                	mov    %eax,%edx
  8009d7:	09 ca                	or     %ecx,%edx
  8009d9:	09 f2                	or     %esi,%edx
  8009db:	f6 c2 03             	test   $0x3,%dl
  8009de:	75 0a                	jne    8009ea <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  8009e0:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  8009e3:	89 c7                	mov    %eax,%edi
  8009e5:	fc                   	cld    
  8009e6:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8009e8:	eb 05                	jmp    8009ef <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  8009ea:	89 c7                	mov    %eax,%edi
  8009ec:	fc                   	cld    
  8009ed:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  8009ef:	5e                   	pop    %esi
  8009f0:	5f                   	pop    %edi
  8009f1:	5d                   	pop    %ebp
  8009f2:	c3                   	ret    

008009f3 <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  8009f3:	f3 0f 1e fb          	endbr32 
  8009f7:	55                   	push   %ebp
  8009f8:	89 e5                	mov    %esp,%ebp
  8009fa:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  8009fd:	ff 75 10             	pushl  0x10(%ebp)
  800a00:	ff 75 0c             	pushl  0xc(%ebp)
  800a03:	ff 75 08             	pushl  0x8(%ebp)
  800a06:	e8 82 ff ff ff       	call   80098d <memmove>
}
  800a0b:	c9                   	leave  
  800a0c:	c3                   	ret    

00800a0d <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800a0d:	f3 0f 1e fb          	endbr32 
  800a11:	55                   	push   %ebp
  800a12:	89 e5                	mov    %esp,%ebp
  800a14:	56                   	push   %esi
  800a15:	53                   	push   %ebx
  800a16:	8b 45 08             	mov    0x8(%ebp),%eax
  800a19:	8b 55 0c             	mov    0xc(%ebp),%edx
  800a1c:	89 c6                	mov    %eax,%esi
  800a1e:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800a21:	39 f0                	cmp    %esi,%eax
  800a23:	74 1c                	je     800a41 <memcmp+0x34>
		if (*s1 != *s2)
  800a25:	0f b6 08             	movzbl (%eax),%ecx
  800a28:	0f b6 1a             	movzbl (%edx),%ebx
  800a2b:	38 d9                	cmp    %bl,%cl
  800a2d:	75 08                	jne    800a37 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800a2f:	83 c0 01             	add    $0x1,%eax
  800a32:	83 c2 01             	add    $0x1,%edx
  800a35:	eb ea                	jmp    800a21 <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800a37:	0f b6 c1             	movzbl %cl,%eax
  800a3a:	0f b6 db             	movzbl %bl,%ebx
  800a3d:	29 d8                	sub    %ebx,%eax
  800a3f:	eb 05                	jmp    800a46 <memcmp+0x39>
	}

	return 0;
  800a41:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a46:	5b                   	pop    %ebx
  800a47:	5e                   	pop    %esi
  800a48:	5d                   	pop    %ebp
  800a49:	c3                   	ret    

00800a4a <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800a4a:	f3 0f 1e fb          	endbr32 
  800a4e:	55                   	push   %ebp
  800a4f:	89 e5                	mov    %esp,%ebp
  800a51:	8b 45 08             	mov    0x8(%ebp),%eax
  800a54:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800a57:	89 c2                	mov    %eax,%edx
  800a59:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800a5c:	39 d0                	cmp    %edx,%eax
  800a5e:	73 09                	jae    800a69 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800a60:	38 08                	cmp    %cl,(%eax)
  800a62:	74 05                	je     800a69 <memfind+0x1f>
	for (; s < ends; s++)
  800a64:	83 c0 01             	add    $0x1,%eax
  800a67:	eb f3                	jmp    800a5c <memfind+0x12>
			break;
	return (void *) s;
}
  800a69:	5d                   	pop    %ebp
  800a6a:	c3                   	ret    

00800a6b <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800a6b:	f3 0f 1e fb          	endbr32 
  800a6f:	55                   	push   %ebp
  800a70:	89 e5                	mov    %esp,%ebp
  800a72:	57                   	push   %edi
  800a73:	56                   	push   %esi
  800a74:	53                   	push   %ebx
  800a75:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800a78:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800a7b:	eb 03                	jmp    800a80 <strtol+0x15>
		s++;
  800a7d:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800a80:	0f b6 01             	movzbl (%ecx),%eax
  800a83:	3c 20                	cmp    $0x20,%al
  800a85:	74 f6                	je     800a7d <strtol+0x12>
  800a87:	3c 09                	cmp    $0x9,%al
  800a89:	74 f2                	je     800a7d <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800a8b:	3c 2b                	cmp    $0x2b,%al
  800a8d:	74 2a                	je     800ab9 <strtol+0x4e>
	int neg = 0;
  800a8f:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800a94:	3c 2d                	cmp    $0x2d,%al
  800a96:	74 2b                	je     800ac3 <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800a98:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800a9e:	75 0f                	jne    800aaf <strtol+0x44>
  800aa0:	80 39 30             	cmpb   $0x30,(%ecx)
  800aa3:	74 28                	je     800acd <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800aa5:	85 db                	test   %ebx,%ebx
  800aa7:	b8 0a 00 00 00       	mov    $0xa,%eax
  800aac:	0f 44 d8             	cmove  %eax,%ebx
  800aaf:	b8 00 00 00 00       	mov    $0x0,%eax
  800ab4:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800ab7:	eb 46                	jmp    800aff <strtol+0x94>
		s++;
  800ab9:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800abc:	bf 00 00 00 00       	mov    $0x0,%edi
  800ac1:	eb d5                	jmp    800a98 <strtol+0x2d>
		s++, neg = 1;
  800ac3:	83 c1 01             	add    $0x1,%ecx
  800ac6:	bf 01 00 00 00       	mov    $0x1,%edi
  800acb:	eb cb                	jmp    800a98 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800acd:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800ad1:	74 0e                	je     800ae1 <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800ad3:	85 db                	test   %ebx,%ebx
  800ad5:	75 d8                	jne    800aaf <strtol+0x44>
		s++, base = 8;
  800ad7:	83 c1 01             	add    $0x1,%ecx
  800ada:	bb 08 00 00 00       	mov    $0x8,%ebx
  800adf:	eb ce                	jmp    800aaf <strtol+0x44>
		s += 2, base = 16;
  800ae1:	83 c1 02             	add    $0x2,%ecx
  800ae4:	bb 10 00 00 00       	mov    $0x10,%ebx
  800ae9:	eb c4                	jmp    800aaf <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800aeb:	0f be d2             	movsbl %dl,%edx
  800aee:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800af1:	3b 55 10             	cmp    0x10(%ebp),%edx
  800af4:	7d 3a                	jge    800b30 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800af6:	83 c1 01             	add    $0x1,%ecx
  800af9:	0f af 45 10          	imul   0x10(%ebp),%eax
  800afd:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800aff:	0f b6 11             	movzbl (%ecx),%edx
  800b02:	8d 72 d0             	lea    -0x30(%edx),%esi
  800b05:	89 f3                	mov    %esi,%ebx
  800b07:	80 fb 09             	cmp    $0x9,%bl
  800b0a:	76 df                	jbe    800aeb <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800b0c:	8d 72 9f             	lea    -0x61(%edx),%esi
  800b0f:	89 f3                	mov    %esi,%ebx
  800b11:	80 fb 19             	cmp    $0x19,%bl
  800b14:	77 08                	ja     800b1e <strtol+0xb3>
			dig = *s - 'a' + 10;
  800b16:	0f be d2             	movsbl %dl,%edx
  800b19:	83 ea 57             	sub    $0x57,%edx
  800b1c:	eb d3                	jmp    800af1 <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800b1e:	8d 72 bf             	lea    -0x41(%edx),%esi
  800b21:	89 f3                	mov    %esi,%ebx
  800b23:	80 fb 19             	cmp    $0x19,%bl
  800b26:	77 08                	ja     800b30 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800b28:	0f be d2             	movsbl %dl,%edx
  800b2b:	83 ea 37             	sub    $0x37,%edx
  800b2e:	eb c1                	jmp    800af1 <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800b30:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800b34:	74 05                	je     800b3b <strtol+0xd0>
		*endptr = (char *) s;
  800b36:	8b 75 0c             	mov    0xc(%ebp),%esi
  800b39:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800b3b:	89 c2                	mov    %eax,%edx
  800b3d:	f7 da                	neg    %edx
  800b3f:	85 ff                	test   %edi,%edi
  800b41:	0f 45 c2             	cmovne %edx,%eax
}
  800b44:	5b                   	pop    %ebx
  800b45:	5e                   	pop    %esi
  800b46:	5f                   	pop    %edi
  800b47:	5d                   	pop    %ebp
  800b48:	c3                   	ret    

00800b49 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800b49:	f3 0f 1e fb          	endbr32 
  800b4d:	55                   	push   %ebp
  800b4e:	89 e5                	mov    %esp,%ebp
  800b50:	57                   	push   %edi
  800b51:	56                   	push   %esi
  800b52:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b53:	b8 00 00 00 00       	mov    $0x0,%eax
  800b58:	8b 55 08             	mov    0x8(%ebp),%edx
  800b5b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800b5e:	89 c3                	mov    %eax,%ebx
  800b60:	89 c7                	mov    %eax,%edi
  800b62:	89 c6                	mov    %eax,%esi
  800b64:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800b66:	5b                   	pop    %ebx
  800b67:	5e                   	pop    %esi
  800b68:	5f                   	pop    %edi
  800b69:	5d                   	pop    %ebp
  800b6a:	c3                   	ret    

00800b6b <sys_cgetc>:

int
sys_cgetc(void)
{
  800b6b:	f3 0f 1e fb          	endbr32 
  800b6f:	55                   	push   %ebp
  800b70:	89 e5                	mov    %esp,%ebp
  800b72:	57                   	push   %edi
  800b73:	56                   	push   %esi
  800b74:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b75:	ba 00 00 00 00       	mov    $0x0,%edx
  800b7a:	b8 01 00 00 00       	mov    $0x1,%eax
  800b7f:	89 d1                	mov    %edx,%ecx
  800b81:	89 d3                	mov    %edx,%ebx
  800b83:	89 d7                	mov    %edx,%edi
  800b85:	89 d6                	mov    %edx,%esi
  800b87:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800b89:	5b                   	pop    %ebx
  800b8a:	5e                   	pop    %esi
  800b8b:	5f                   	pop    %edi
  800b8c:	5d                   	pop    %ebp
  800b8d:	c3                   	ret    

00800b8e <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800b8e:	f3 0f 1e fb          	endbr32 
  800b92:	55                   	push   %ebp
  800b93:	89 e5                	mov    %esp,%ebp
  800b95:	57                   	push   %edi
  800b96:	56                   	push   %esi
  800b97:	53                   	push   %ebx
  800b98:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800b9b:	b9 00 00 00 00       	mov    $0x0,%ecx
  800ba0:	8b 55 08             	mov    0x8(%ebp),%edx
  800ba3:	b8 03 00 00 00       	mov    $0x3,%eax
  800ba8:	89 cb                	mov    %ecx,%ebx
  800baa:	89 cf                	mov    %ecx,%edi
  800bac:	89 ce                	mov    %ecx,%esi
  800bae:	cd 30                	int    $0x30
	if(check && ret > 0)
  800bb0:	85 c0                	test   %eax,%eax
  800bb2:	7f 08                	jg     800bbc <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800bb4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800bb7:	5b                   	pop    %ebx
  800bb8:	5e                   	pop    %esi
  800bb9:	5f                   	pop    %edi
  800bba:	5d                   	pop    %ebp
  800bbb:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800bbc:	83 ec 0c             	sub    $0xc,%esp
  800bbf:	50                   	push   %eax
  800bc0:	6a 03                	push   $0x3
  800bc2:	68 7f 26 80 00       	push   $0x80267f
  800bc7:	6a 23                	push   $0x23
  800bc9:	68 9c 26 80 00       	push   $0x80269c
  800bce:	e8 dd 12 00 00       	call   801eb0 <_panic>

00800bd3 <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800bd3:	f3 0f 1e fb          	endbr32 
  800bd7:	55                   	push   %ebp
  800bd8:	89 e5                	mov    %esp,%ebp
  800bda:	57                   	push   %edi
  800bdb:	56                   	push   %esi
  800bdc:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bdd:	ba 00 00 00 00       	mov    $0x0,%edx
  800be2:	b8 02 00 00 00       	mov    $0x2,%eax
  800be7:	89 d1                	mov    %edx,%ecx
  800be9:	89 d3                	mov    %edx,%ebx
  800beb:	89 d7                	mov    %edx,%edi
  800bed:	89 d6                	mov    %edx,%esi
  800bef:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800bf1:	5b                   	pop    %ebx
  800bf2:	5e                   	pop    %esi
  800bf3:	5f                   	pop    %edi
  800bf4:	5d                   	pop    %ebp
  800bf5:	c3                   	ret    

00800bf6 <sys_yield>:

void
sys_yield(void)
{
  800bf6:	f3 0f 1e fb          	endbr32 
  800bfa:	55                   	push   %ebp
  800bfb:	89 e5                	mov    %esp,%ebp
  800bfd:	57                   	push   %edi
  800bfe:	56                   	push   %esi
  800bff:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c00:	ba 00 00 00 00       	mov    $0x0,%edx
  800c05:	b8 0b 00 00 00       	mov    $0xb,%eax
  800c0a:	89 d1                	mov    %edx,%ecx
  800c0c:	89 d3                	mov    %edx,%ebx
  800c0e:	89 d7                	mov    %edx,%edi
  800c10:	89 d6                	mov    %edx,%esi
  800c12:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800c14:	5b                   	pop    %ebx
  800c15:	5e                   	pop    %esi
  800c16:	5f                   	pop    %edi
  800c17:	5d                   	pop    %ebp
  800c18:	c3                   	ret    

00800c19 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800c19:	f3 0f 1e fb          	endbr32 
  800c1d:	55                   	push   %ebp
  800c1e:	89 e5                	mov    %esp,%ebp
  800c20:	57                   	push   %edi
  800c21:	56                   	push   %esi
  800c22:	53                   	push   %ebx
  800c23:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c26:	be 00 00 00 00       	mov    $0x0,%esi
  800c2b:	8b 55 08             	mov    0x8(%ebp),%edx
  800c2e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c31:	b8 04 00 00 00       	mov    $0x4,%eax
  800c36:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c39:	89 f7                	mov    %esi,%edi
  800c3b:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c3d:	85 c0                	test   %eax,%eax
  800c3f:	7f 08                	jg     800c49 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800c41:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c44:	5b                   	pop    %ebx
  800c45:	5e                   	pop    %esi
  800c46:	5f                   	pop    %edi
  800c47:	5d                   	pop    %ebp
  800c48:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c49:	83 ec 0c             	sub    $0xc,%esp
  800c4c:	50                   	push   %eax
  800c4d:	6a 04                	push   $0x4
  800c4f:	68 7f 26 80 00       	push   $0x80267f
  800c54:	6a 23                	push   $0x23
  800c56:	68 9c 26 80 00       	push   $0x80269c
  800c5b:	e8 50 12 00 00       	call   801eb0 <_panic>

00800c60 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800c60:	f3 0f 1e fb          	endbr32 
  800c64:	55                   	push   %ebp
  800c65:	89 e5                	mov    %esp,%ebp
  800c67:	57                   	push   %edi
  800c68:	56                   	push   %esi
  800c69:	53                   	push   %ebx
  800c6a:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c6d:	8b 55 08             	mov    0x8(%ebp),%edx
  800c70:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c73:	b8 05 00 00 00       	mov    $0x5,%eax
  800c78:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c7b:	8b 7d 14             	mov    0x14(%ebp),%edi
  800c7e:	8b 75 18             	mov    0x18(%ebp),%esi
  800c81:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c83:	85 c0                	test   %eax,%eax
  800c85:	7f 08                	jg     800c8f <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800c87:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c8a:	5b                   	pop    %ebx
  800c8b:	5e                   	pop    %esi
  800c8c:	5f                   	pop    %edi
  800c8d:	5d                   	pop    %ebp
  800c8e:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c8f:	83 ec 0c             	sub    $0xc,%esp
  800c92:	50                   	push   %eax
  800c93:	6a 05                	push   $0x5
  800c95:	68 7f 26 80 00       	push   $0x80267f
  800c9a:	6a 23                	push   $0x23
  800c9c:	68 9c 26 80 00       	push   $0x80269c
  800ca1:	e8 0a 12 00 00       	call   801eb0 <_panic>

00800ca6 <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800ca6:	f3 0f 1e fb          	endbr32 
  800caa:	55                   	push   %ebp
  800cab:	89 e5                	mov    %esp,%ebp
  800cad:	57                   	push   %edi
  800cae:	56                   	push   %esi
  800caf:	53                   	push   %ebx
  800cb0:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cb3:	bb 00 00 00 00       	mov    $0x0,%ebx
  800cb8:	8b 55 08             	mov    0x8(%ebp),%edx
  800cbb:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800cbe:	b8 06 00 00 00       	mov    $0x6,%eax
  800cc3:	89 df                	mov    %ebx,%edi
  800cc5:	89 de                	mov    %ebx,%esi
  800cc7:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cc9:	85 c0                	test   %eax,%eax
  800ccb:	7f 08                	jg     800cd5 <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800ccd:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800cd0:	5b                   	pop    %ebx
  800cd1:	5e                   	pop    %esi
  800cd2:	5f                   	pop    %edi
  800cd3:	5d                   	pop    %ebp
  800cd4:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800cd5:	83 ec 0c             	sub    $0xc,%esp
  800cd8:	50                   	push   %eax
  800cd9:	6a 06                	push   $0x6
  800cdb:	68 7f 26 80 00       	push   $0x80267f
  800ce0:	6a 23                	push   $0x23
  800ce2:	68 9c 26 80 00       	push   $0x80269c
  800ce7:	e8 c4 11 00 00       	call   801eb0 <_panic>

00800cec <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800cec:	f3 0f 1e fb          	endbr32 
  800cf0:	55                   	push   %ebp
  800cf1:	89 e5                	mov    %esp,%ebp
  800cf3:	57                   	push   %edi
  800cf4:	56                   	push   %esi
  800cf5:	53                   	push   %ebx
  800cf6:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cf9:	bb 00 00 00 00       	mov    $0x0,%ebx
  800cfe:	8b 55 08             	mov    0x8(%ebp),%edx
  800d01:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d04:	b8 08 00 00 00       	mov    $0x8,%eax
  800d09:	89 df                	mov    %ebx,%edi
  800d0b:	89 de                	mov    %ebx,%esi
  800d0d:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d0f:	85 c0                	test   %eax,%eax
  800d11:	7f 08                	jg     800d1b <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800d13:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d16:	5b                   	pop    %ebx
  800d17:	5e                   	pop    %esi
  800d18:	5f                   	pop    %edi
  800d19:	5d                   	pop    %ebp
  800d1a:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d1b:	83 ec 0c             	sub    $0xc,%esp
  800d1e:	50                   	push   %eax
  800d1f:	6a 08                	push   $0x8
  800d21:	68 7f 26 80 00       	push   $0x80267f
  800d26:	6a 23                	push   $0x23
  800d28:	68 9c 26 80 00       	push   $0x80269c
  800d2d:	e8 7e 11 00 00       	call   801eb0 <_panic>

00800d32 <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800d32:	f3 0f 1e fb          	endbr32 
  800d36:	55                   	push   %ebp
  800d37:	89 e5                	mov    %esp,%ebp
  800d39:	57                   	push   %edi
  800d3a:	56                   	push   %esi
  800d3b:	53                   	push   %ebx
  800d3c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d3f:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d44:	8b 55 08             	mov    0x8(%ebp),%edx
  800d47:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d4a:	b8 09 00 00 00       	mov    $0x9,%eax
  800d4f:	89 df                	mov    %ebx,%edi
  800d51:	89 de                	mov    %ebx,%esi
  800d53:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d55:	85 c0                	test   %eax,%eax
  800d57:	7f 08                	jg     800d61 <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800d59:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d5c:	5b                   	pop    %ebx
  800d5d:	5e                   	pop    %esi
  800d5e:	5f                   	pop    %edi
  800d5f:	5d                   	pop    %ebp
  800d60:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d61:	83 ec 0c             	sub    $0xc,%esp
  800d64:	50                   	push   %eax
  800d65:	6a 09                	push   $0x9
  800d67:	68 7f 26 80 00       	push   $0x80267f
  800d6c:	6a 23                	push   $0x23
  800d6e:	68 9c 26 80 00       	push   $0x80269c
  800d73:	e8 38 11 00 00       	call   801eb0 <_panic>

00800d78 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800d78:	f3 0f 1e fb          	endbr32 
  800d7c:	55                   	push   %ebp
  800d7d:	89 e5                	mov    %esp,%ebp
  800d7f:	57                   	push   %edi
  800d80:	56                   	push   %esi
  800d81:	53                   	push   %ebx
  800d82:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d85:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d8a:	8b 55 08             	mov    0x8(%ebp),%edx
  800d8d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d90:	b8 0a 00 00 00       	mov    $0xa,%eax
  800d95:	89 df                	mov    %ebx,%edi
  800d97:	89 de                	mov    %ebx,%esi
  800d99:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d9b:	85 c0                	test   %eax,%eax
  800d9d:	7f 08                	jg     800da7 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800d9f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800da2:	5b                   	pop    %ebx
  800da3:	5e                   	pop    %esi
  800da4:	5f                   	pop    %edi
  800da5:	5d                   	pop    %ebp
  800da6:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800da7:	83 ec 0c             	sub    $0xc,%esp
  800daa:	50                   	push   %eax
  800dab:	6a 0a                	push   $0xa
  800dad:	68 7f 26 80 00       	push   $0x80267f
  800db2:	6a 23                	push   $0x23
  800db4:	68 9c 26 80 00       	push   $0x80269c
  800db9:	e8 f2 10 00 00       	call   801eb0 <_panic>

00800dbe <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800dbe:	f3 0f 1e fb          	endbr32 
  800dc2:	55                   	push   %ebp
  800dc3:	89 e5                	mov    %esp,%ebp
  800dc5:	57                   	push   %edi
  800dc6:	56                   	push   %esi
  800dc7:	53                   	push   %ebx
	asm volatile("int %1\n"
  800dc8:	8b 55 08             	mov    0x8(%ebp),%edx
  800dcb:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800dce:	b8 0c 00 00 00       	mov    $0xc,%eax
  800dd3:	be 00 00 00 00       	mov    $0x0,%esi
  800dd8:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800ddb:	8b 7d 14             	mov    0x14(%ebp),%edi
  800dde:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800de0:	5b                   	pop    %ebx
  800de1:	5e                   	pop    %esi
  800de2:	5f                   	pop    %edi
  800de3:	5d                   	pop    %ebp
  800de4:	c3                   	ret    

00800de5 <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800de5:	f3 0f 1e fb          	endbr32 
  800de9:	55                   	push   %ebp
  800dea:	89 e5                	mov    %esp,%ebp
  800dec:	57                   	push   %edi
  800ded:	56                   	push   %esi
  800dee:	53                   	push   %ebx
  800def:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800df2:	b9 00 00 00 00       	mov    $0x0,%ecx
  800df7:	8b 55 08             	mov    0x8(%ebp),%edx
  800dfa:	b8 0d 00 00 00       	mov    $0xd,%eax
  800dff:	89 cb                	mov    %ecx,%ebx
  800e01:	89 cf                	mov    %ecx,%edi
  800e03:	89 ce                	mov    %ecx,%esi
  800e05:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e07:	85 c0                	test   %eax,%eax
  800e09:	7f 08                	jg     800e13 <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800e0b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e0e:	5b                   	pop    %ebx
  800e0f:	5e                   	pop    %esi
  800e10:	5f                   	pop    %edi
  800e11:	5d                   	pop    %ebp
  800e12:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e13:	83 ec 0c             	sub    $0xc,%esp
  800e16:	50                   	push   %eax
  800e17:	6a 0d                	push   $0xd
  800e19:	68 7f 26 80 00       	push   $0x80267f
  800e1e:	6a 23                	push   $0x23
  800e20:	68 9c 26 80 00       	push   $0x80269c
  800e25:	e8 86 10 00 00       	call   801eb0 <_panic>

00800e2a <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800e2a:	f3 0f 1e fb          	endbr32 
  800e2e:	55                   	push   %ebp
  800e2f:	89 e5                	mov    %esp,%ebp
  800e31:	56                   	push   %esi
  800e32:	53                   	push   %ebx
  800e33:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800e36:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e38:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800e3c:	0f 84 b2 00 00 00    	je     800ef4 <pgfault+0xca>
  800e42:	89 d8                	mov    %ebx,%eax
  800e44:	c1 e8 16             	shr    $0x16,%eax
  800e47:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800e4e:	a8 01                	test   $0x1,%al
  800e50:	0f 84 9e 00 00 00    	je     800ef4 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800e56:	89 d8                	mov    %ebx,%eax
  800e58:	c1 e8 0c             	shr    $0xc,%eax
  800e5b:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e62:	f6 c2 01             	test   $0x1,%dl
  800e65:	0f 84 89 00 00 00    	je     800ef4 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800e6b:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e72:	f6 c4 08             	test   $0x8,%ah
  800e75:	74 7d                	je     800ef4 <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800e77:	e8 57 fd ff ff       	call   800bd3 <sys_getenvid>
  800e7c:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800e7e:	83 ec 04             	sub    $0x4,%esp
  800e81:	6a 07                	push   $0x7
  800e83:	68 00 f0 7f 00       	push   $0x7ff000
  800e88:	50                   	push   %eax
  800e89:	e8 8b fd ff ff       	call   800c19 <sys_page_alloc>
	if(r<0){
  800e8e:	83 c4 10             	add    $0x10,%esp
  800e91:	85 c0                	test   %eax,%eax
  800e93:	78 73                	js     800f08 <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800e95:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800e9b:	83 ec 04             	sub    $0x4,%esp
  800e9e:	68 00 10 00 00       	push   $0x1000
  800ea3:	53                   	push   %ebx
  800ea4:	68 00 f0 7f 00       	push   $0x7ff000
  800ea9:	e8 df fa ff ff       	call   80098d <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800eae:	83 c4 08             	add    $0x8,%esp
  800eb1:	53                   	push   %ebx
  800eb2:	56                   	push   %esi
  800eb3:	e8 ee fd ff ff       	call   800ca6 <sys_page_unmap>
	if(r<0)
  800eb8:	83 c4 10             	add    $0x10,%esp
  800ebb:	85 c0                	test   %eax,%eax
  800ebd:	78 5b                	js     800f1a <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  800ebf:	83 ec 0c             	sub    $0xc,%esp
  800ec2:	6a 07                	push   $0x7
  800ec4:	53                   	push   %ebx
  800ec5:	56                   	push   %esi
  800ec6:	68 00 f0 7f 00       	push   $0x7ff000
  800ecb:	56                   	push   %esi
  800ecc:	e8 8f fd ff ff       	call   800c60 <sys_page_map>
	if(r<0)
  800ed1:	83 c4 20             	add    $0x20,%esp
  800ed4:	85 c0                	test   %eax,%eax
  800ed6:	78 54                	js     800f2c <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  800ed8:	83 ec 08             	sub    $0x8,%esp
  800edb:	68 00 f0 7f 00       	push   $0x7ff000
  800ee0:	56                   	push   %esi
  800ee1:	e8 c0 fd ff ff       	call   800ca6 <sys_page_unmap>
	if(r<0)
  800ee6:	83 c4 10             	add    $0x10,%esp
  800ee9:	85 c0                	test   %eax,%eax
  800eeb:	78 51                	js     800f3e <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  800eed:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800ef0:	5b                   	pop    %ebx
  800ef1:	5e                   	pop    %esi
  800ef2:	5d                   	pop    %ebp
  800ef3:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  800ef4:	83 ec 04             	sub    $0x4,%esp
  800ef7:	68 ac 26 80 00       	push   $0x8026ac
  800efc:	6a 2c                	push   $0x2c
  800efe:	68 5b 27 80 00       	push   $0x80275b
  800f03:	e8 a8 0f 00 00       	call   801eb0 <_panic>
		 panic("pgfault: page allocation failed %e", r);
  800f08:	50                   	push   %eax
  800f09:	68 ec 26 80 00       	push   $0x8026ec
  800f0e:	6a 31                	push   $0x31
  800f10:	68 5b 27 80 00       	push   $0x80275b
  800f15:	e8 96 0f 00 00       	call   801eb0 <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f1a:	50                   	push   %eax
  800f1b:	68 66 27 80 00       	push   $0x802766
  800f20:	6a 3b                	push   $0x3b
  800f22:	68 5b 27 80 00       	push   $0x80275b
  800f27:	e8 84 0f 00 00       	call   801eb0 <_panic>
	panic("pgfault: page map failed %e", r);
  800f2c:	50                   	push   %eax
  800f2d:	68 84 27 80 00       	push   $0x802784
  800f32:	6a 3e                	push   $0x3e
  800f34:	68 5b 27 80 00       	push   $0x80275b
  800f39:	e8 72 0f 00 00       	call   801eb0 <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f3e:	50                   	push   %eax
  800f3f:	68 66 27 80 00       	push   $0x802766
  800f44:	6a 41                	push   $0x41
  800f46:	68 5b 27 80 00       	push   $0x80275b
  800f4b:	e8 60 0f 00 00       	call   801eb0 <_panic>

00800f50 <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  800f50:	f3 0f 1e fb          	endbr32 
  800f54:	55                   	push   %ebp
  800f55:	89 e5                	mov    %esp,%ebp
  800f57:	57                   	push   %edi
  800f58:	56                   	push   %esi
  800f59:	53                   	push   %ebx
  800f5a:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  800f5d:	68 2a 0e 80 00       	push   $0x800e2a
  800f62:	e8 93 0f 00 00       	call   801efa <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  800f67:	b8 07 00 00 00       	mov    $0x7,%eax
  800f6c:	cd 30                	int    $0x30
  800f6e:	89 c7                	mov    %eax,%edi
  800f70:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  800f73:	83 c4 10             	add    $0x10,%esp
  800f76:	85 c0                	test   %eax,%eax
  800f78:	0f 8e 9d 01 00 00    	jle    80111b <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800f7e:	bb 00 00 80 00       	mov    $0x800000,%ebx
  800f83:	eb 5b                	jmp    800fe0 <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  800f85:	83 ec 0c             	sub    $0xc,%esp
  800f88:	68 07 0e 00 00       	push   $0xe07
  800f8d:	56                   	push   %esi
  800f8e:	ff 75 e4             	pushl  -0x1c(%ebp)
  800f91:	56                   	push   %esi
  800f92:	6a 00                	push   $0x0
  800f94:	e8 c7 fc ff ff       	call   800c60 <sys_page_map>
  800f99:	83 c4 20             	add    $0x20,%esp
  800f9c:	eb 30                	jmp    800fce <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  800f9e:	83 ec 04             	sub    $0x4,%esp
  800fa1:	68 a0 27 80 00       	push   $0x8027a0
  800fa6:	6a 63                	push   $0x63
  800fa8:	68 5b 27 80 00       	push   $0x80275b
  800fad:	e8 fe 0e 00 00       	call   801eb0 <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  800fb2:	83 ec 0c             	sub    $0xc,%esp
  800fb5:	6a 05                	push   $0x5
  800fb7:	56                   	push   %esi
  800fb8:	ff 75 e4             	pushl  -0x1c(%ebp)
  800fbb:	56                   	push   %esi
  800fbc:	6a 00                	push   $0x0
  800fbe:	e8 9d fc ff ff       	call   800c60 <sys_page_map>
            if(r < 0)
  800fc3:	83 c4 20             	add    $0x20,%esp
  800fc6:	85 c0                	test   %eax,%eax
  800fc8:	0f 88 ac 00 00 00    	js     80107a <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800fce:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  800fd4:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  800fda:	0f 84 ae 00 00 00    	je     80108e <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  800fe0:	89 d8                	mov    %ebx,%eax
  800fe2:	c1 e8 16             	shr    $0x16,%eax
  800fe5:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800fec:	a8 01                	test   $0x1,%al
  800fee:	74 de                	je     800fce <fork+0x7e>
			pn=PGNUM(pageVa);
  800ff0:	89 d8                	mov    %ebx,%eax
  800ff2:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  800ff5:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  800ffc:	f6 c2 01             	test   $0x1,%dl
  800fff:	74 cd                	je     800fce <fork+0x7e>
  801001:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801008:	f6 c2 04             	test   $0x4,%dl
  80100b:	74 c1                	je     800fce <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  80100d:	89 c6                	mov    %eax,%esi
  80100f:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  801012:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  801019:	f6 c4 04             	test   $0x4,%ah
  80101c:	0f 85 63 ff ff ff    	jne    800f85 <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  801022:	a9 02 08 00 00       	test   $0x802,%eax
  801027:	74 89                	je     800fb2 <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  801029:	83 ec 0c             	sub    $0xc,%esp
  80102c:	68 05 08 00 00       	push   $0x805
  801031:	56                   	push   %esi
  801032:	ff 75 e4             	pushl  -0x1c(%ebp)
  801035:	56                   	push   %esi
  801036:	6a 00                	push   $0x0
  801038:	e8 23 fc ff ff       	call   800c60 <sys_page_map>
            if(r < 0)
  80103d:	83 c4 20             	add    $0x20,%esp
  801040:	85 c0                	test   %eax,%eax
  801042:	0f 88 56 ff ff ff    	js     800f9e <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  801048:	83 ec 0c             	sub    $0xc,%esp
  80104b:	68 05 08 00 00       	push   $0x805
  801050:	56                   	push   %esi
  801051:	6a 00                	push   $0x0
  801053:	56                   	push   %esi
  801054:	6a 00                	push   $0x0
  801056:	e8 05 fc ff ff       	call   800c60 <sys_page_map>
            if(r < 0)
  80105b:	83 c4 20             	add    $0x20,%esp
  80105e:	85 c0                	test   %eax,%eax
  801060:	0f 89 68 ff ff ff    	jns    800fce <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  801066:	83 ec 04             	sub    $0x4,%esp
  801069:	68 a0 27 80 00       	push   $0x8027a0
  80106e:	6a 66                	push   $0x66
  801070:	68 5b 27 80 00       	push   $0x80275b
  801075:	e8 36 0e 00 00       	call   801eb0 <_panic>
                panic("duppage: sys_page_map fail\n");
  80107a:	83 ec 04             	sub    $0x4,%esp
  80107d:	68 a0 27 80 00       	push   $0x8027a0
  801082:	6a 6c                	push   $0x6c
  801084:	68 5b 27 80 00       	push   $0x80275b
  801089:	e8 22 0e 00 00       	call   801eb0 <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  80108e:	83 ec 04             	sub    $0x4,%esp
  801091:	6a 07                	push   $0x7
  801093:	68 00 f0 bf ee       	push   $0xeebff000
  801098:	57                   	push   %edi
  801099:	e8 7b fb ff ff       	call   800c19 <sys_page_alloc>
		if(flag<0){
  80109e:	83 c4 10             	add    $0x10,%esp
  8010a1:	85 c0                	test   %eax,%eax
  8010a3:	78 31                	js     8010d6 <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  8010a5:	83 ec 08             	sub    $0x8,%esp
  8010a8:	68 74 1f 80 00       	push   $0x801f74
  8010ad:	57                   	push   %edi
  8010ae:	e8 c5 fc ff ff       	call   800d78 <sys_env_set_pgfault_upcall>
		if(flag<0){
  8010b3:	83 c4 10             	add    $0x10,%esp
  8010b6:	85 c0                	test   %eax,%eax
  8010b8:	78 33                	js     8010ed <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  8010ba:	83 ec 08             	sub    $0x8,%esp
  8010bd:	6a 02                	push   $0x2
  8010bf:	57                   	push   %edi
  8010c0:	e8 27 fc ff ff       	call   800cec <sys_env_set_status>
		if(flag<0){
  8010c5:	83 c4 10             	add    $0x10,%esp
  8010c8:	85 c0                	test   %eax,%eax
  8010ca:	78 38                	js     801104 <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  8010cc:	89 f8                	mov    %edi,%eax
  8010ce:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8010d1:	5b                   	pop    %ebx
  8010d2:	5e                   	pop    %esi
  8010d3:	5f                   	pop    %edi
  8010d4:	5d                   	pop    %ebp
  8010d5:	c3                   	ret    
			panic("panic by alloc page");
  8010d6:	83 ec 04             	sub    $0x4,%esp
  8010d9:	68 bc 27 80 00       	push   $0x8027bc
  8010de:	68 98 00 00 00       	push   $0x98
  8010e3:	68 5b 27 80 00       	push   $0x80275b
  8010e8:	e8 c3 0d 00 00       	call   801eb0 <_panic>
			panic("panic by set pgfault upcall faction");
  8010ed:	83 ec 04             	sub    $0x4,%esp
  8010f0:	68 10 27 80 00       	push   $0x802710
  8010f5:	68 9e 00 00 00       	push   $0x9e
  8010fa:	68 5b 27 80 00       	push   $0x80275b
  8010ff:	e8 ac 0d 00 00       	call   801eb0 <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  801104:	83 ec 04             	sub    $0x4,%esp
  801107:	68 34 27 80 00       	push   $0x802734
  80110c:	68 a3 00 00 00       	push   $0xa3
  801111:	68 5b 27 80 00       	push   $0x80275b
  801116:	e8 95 0d 00 00       	call   801eb0 <_panic>
	else if(envid==0){
  80111b:	75 19                	jne    801136 <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  80111d:	e8 b1 fa ff ff       	call   800bd3 <sys_getenvid>
  801122:	25 ff 03 00 00       	and    $0x3ff,%eax
  801127:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80112a:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  80112f:	a3 04 40 80 00       	mov    %eax,0x804004
		return 0;
  801134:	eb 96                	jmp    8010cc <fork+0x17c>
		panic("panic by alloc envid");
  801136:	83 ec 04             	sub    $0x4,%esp
  801139:	68 d0 27 80 00       	push   $0x8027d0
  80113e:	68 ad 00 00 00       	push   $0xad
  801143:	68 5b 27 80 00       	push   $0x80275b
  801148:	e8 63 0d 00 00       	call   801eb0 <_panic>

0080114d <sfork>:

// Challenge!
int
sfork(void)
{
  80114d:	f3 0f 1e fb          	endbr32 
  801151:	55                   	push   %ebp
  801152:	89 e5                	mov    %esp,%ebp
  801154:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  801157:	68 e5 27 80 00       	push   $0x8027e5
  80115c:	68 b7 00 00 00       	push   $0xb7
  801161:	68 5b 27 80 00       	push   $0x80275b
  801166:	e8 45 0d 00 00       	call   801eb0 <_panic>

0080116b <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  80116b:	f3 0f 1e fb          	endbr32 
  80116f:	55                   	push   %ebp
  801170:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801172:	8b 45 08             	mov    0x8(%ebp),%eax
  801175:	05 00 00 00 30       	add    $0x30000000,%eax
  80117a:	c1 e8 0c             	shr    $0xc,%eax
}
  80117d:	5d                   	pop    %ebp
  80117e:	c3                   	ret    

0080117f <fd2data>:

char*
fd2data(struct Fd *fd)
{
  80117f:	f3 0f 1e fb          	endbr32 
  801183:	55                   	push   %ebp
  801184:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801186:	8b 45 08             	mov    0x8(%ebp),%eax
  801189:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  80118e:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  801193:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  801198:	5d                   	pop    %ebp
  801199:	c3                   	ret    

0080119a <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  80119a:	f3 0f 1e fb          	endbr32 
  80119e:	55                   	push   %ebp
  80119f:	89 e5                	mov    %esp,%ebp
  8011a1:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  8011a6:	89 c2                	mov    %eax,%edx
  8011a8:	c1 ea 16             	shr    $0x16,%edx
  8011ab:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  8011b2:	f6 c2 01             	test   $0x1,%dl
  8011b5:	74 2d                	je     8011e4 <fd_alloc+0x4a>
  8011b7:	89 c2                	mov    %eax,%edx
  8011b9:	c1 ea 0c             	shr    $0xc,%edx
  8011bc:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8011c3:	f6 c2 01             	test   $0x1,%dl
  8011c6:	74 1c                	je     8011e4 <fd_alloc+0x4a>
  8011c8:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  8011cd:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  8011d2:	75 d2                	jne    8011a6 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  8011d4:	8b 45 08             	mov    0x8(%ebp),%eax
  8011d7:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  8011dd:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  8011e2:	eb 0a                	jmp    8011ee <fd_alloc+0x54>
			*fd_store = fd;
  8011e4:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8011e7:	89 01                	mov    %eax,(%ecx)
			return 0;
  8011e9:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8011ee:	5d                   	pop    %ebp
  8011ef:	c3                   	ret    

008011f0 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  8011f0:	f3 0f 1e fb          	endbr32 
  8011f4:	55                   	push   %ebp
  8011f5:	89 e5                	mov    %esp,%ebp
  8011f7:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  8011fa:	83 f8 1f             	cmp    $0x1f,%eax
  8011fd:	77 30                	ja     80122f <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  8011ff:	c1 e0 0c             	shl    $0xc,%eax
  801202:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  801207:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  80120d:	f6 c2 01             	test   $0x1,%dl
  801210:	74 24                	je     801236 <fd_lookup+0x46>
  801212:	89 c2                	mov    %eax,%edx
  801214:	c1 ea 0c             	shr    $0xc,%edx
  801217:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  80121e:	f6 c2 01             	test   $0x1,%dl
  801221:	74 1a                	je     80123d <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  801223:	8b 55 0c             	mov    0xc(%ebp),%edx
  801226:	89 02                	mov    %eax,(%edx)
	return 0;
  801228:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80122d:	5d                   	pop    %ebp
  80122e:	c3                   	ret    
		return -E_INVAL;
  80122f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801234:	eb f7                	jmp    80122d <fd_lookup+0x3d>
		return -E_INVAL;
  801236:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80123b:	eb f0                	jmp    80122d <fd_lookup+0x3d>
  80123d:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801242:	eb e9                	jmp    80122d <fd_lookup+0x3d>

00801244 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  801244:	f3 0f 1e fb          	endbr32 
  801248:	55                   	push   %ebp
  801249:	89 e5                	mov    %esp,%ebp
  80124b:	83 ec 08             	sub    $0x8,%esp
  80124e:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801251:	ba 78 28 80 00       	mov    $0x802878,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  801256:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  80125b:	39 08                	cmp    %ecx,(%eax)
  80125d:	74 33                	je     801292 <dev_lookup+0x4e>
  80125f:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  801262:	8b 02                	mov    (%edx),%eax
  801264:	85 c0                	test   %eax,%eax
  801266:	75 f3                	jne    80125b <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  801268:	a1 04 40 80 00       	mov    0x804004,%eax
  80126d:	8b 40 48             	mov    0x48(%eax),%eax
  801270:	83 ec 04             	sub    $0x4,%esp
  801273:	51                   	push   %ecx
  801274:	50                   	push   %eax
  801275:	68 fc 27 80 00       	push   $0x8027fc
  80127a:	e8 7f ef ff ff       	call   8001fe <cprintf>
	*dev = 0;
  80127f:	8b 45 0c             	mov    0xc(%ebp),%eax
  801282:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  801288:	83 c4 10             	add    $0x10,%esp
  80128b:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  801290:	c9                   	leave  
  801291:	c3                   	ret    
			*dev = devtab[i];
  801292:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801295:	89 01                	mov    %eax,(%ecx)
			return 0;
  801297:	b8 00 00 00 00       	mov    $0x0,%eax
  80129c:	eb f2                	jmp    801290 <dev_lookup+0x4c>

0080129e <fd_close>:
{
  80129e:	f3 0f 1e fb          	endbr32 
  8012a2:	55                   	push   %ebp
  8012a3:	89 e5                	mov    %esp,%ebp
  8012a5:	57                   	push   %edi
  8012a6:	56                   	push   %esi
  8012a7:	53                   	push   %ebx
  8012a8:	83 ec 24             	sub    $0x24,%esp
  8012ab:	8b 75 08             	mov    0x8(%ebp),%esi
  8012ae:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8012b1:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8012b4:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8012b5:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  8012bb:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8012be:	50                   	push   %eax
  8012bf:	e8 2c ff ff ff       	call   8011f0 <fd_lookup>
  8012c4:	89 c3                	mov    %eax,%ebx
  8012c6:	83 c4 10             	add    $0x10,%esp
  8012c9:	85 c0                	test   %eax,%eax
  8012cb:	78 05                	js     8012d2 <fd_close+0x34>
	    || fd != fd2)
  8012cd:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  8012d0:	74 16                	je     8012e8 <fd_close+0x4a>
		return (must_exist ? r : 0);
  8012d2:	89 f8                	mov    %edi,%eax
  8012d4:	84 c0                	test   %al,%al
  8012d6:	b8 00 00 00 00       	mov    $0x0,%eax
  8012db:	0f 44 d8             	cmove  %eax,%ebx
}
  8012de:	89 d8                	mov    %ebx,%eax
  8012e0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012e3:	5b                   	pop    %ebx
  8012e4:	5e                   	pop    %esi
  8012e5:	5f                   	pop    %edi
  8012e6:	5d                   	pop    %ebp
  8012e7:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  8012e8:	83 ec 08             	sub    $0x8,%esp
  8012eb:	8d 45 e0             	lea    -0x20(%ebp),%eax
  8012ee:	50                   	push   %eax
  8012ef:	ff 36                	pushl  (%esi)
  8012f1:	e8 4e ff ff ff       	call   801244 <dev_lookup>
  8012f6:	89 c3                	mov    %eax,%ebx
  8012f8:	83 c4 10             	add    $0x10,%esp
  8012fb:	85 c0                	test   %eax,%eax
  8012fd:	78 1a                	js     801319 <fd_close+0x7b>
		if (dev->dev_close)
  8012ff:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801302:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  801305:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  80130a:	85 c0                	test   %eax,%eax
  80130c:	74 0b                	je     801319 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  80130e:	83 ec 0c             	sub    $0xc,%esp
  801311:	56                   	push   %esi
  801312:	ff d0                	call   *%eax
  801314:	89 c3                	mov    %eax,%ebx
  801316:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801319:	83 ec 08             	sub    $0x8,%esp
  80131c:	56                   	push   %esi
  80131d:	6a 00                	push   $0x0
  80131f:	e8 82 f9 ff ff       	call   800ca6 <sys_page_unmap>
	return r;
  801324:	83 c4 10             	add    $0x10,%esp
  801327:	eb b5                	jmp    8012de <fd_close+0x40>

00801329 <close>:

int
close(int fdnum)
{
  801329:	f3 0f 1e fb          	endbr32 
  80132d:	55                   	push   %ebp
  80132e:	89 e5                	mov    %esp,%ebp
  801330:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801333:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801336:	50                   	push   %eax
  801337:	ff 75 08             	pushl  0x8(%ebp)
  80133a:	e8 b1 fe ff ff       	call   8011f0 <fd_lookup>
  80133f:	83 c4 10             	add    $0x10,%esp
  801342:	85 c0                	test   %eax,%eax
  801344:	79 02                	jns    801348 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  801346:	c9                   	leave  
  801347:	c3                   	ret    
		return fd_close(fd, 1);
  801348:	83 ec 08             	sub    $0x8,%esp
  80134b:	6a 01                	push   $0x1
  80134d:	ff 75 f4             	pushl  -0xc(%ebp)
  801350:	e8 49 ff ff ff       	call   80129e <fd_close>
  801355:	83 c4 10             	add    $0x10,%esp
  801358:	eb ec                	jmp    801346 <close+0x1d>

0080135a <close_all>:

void
close_all(void)
{
  80135a:	f3 0f 1e fb          	endbr32 
  80135e:	55                   	push   %ebp
  80135f:	89 e5                	mov    %esp,%ebp
  801361:	53                   	push   %ebx
  801362:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  801365:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  80136a:	83 ec 0c             	sub    $0xc,%esp
  80136d:	53                   	push   %ebx
  80136e:	e8 b6 ff ff ff       	call   801329 <close>
	for (i = 0; i < MAXFD; i++)
  801373:	83 c3 01             	add    $0x1,%ebx
  801376:	83 c4 10             	add    $0x10,%esp
  801379:	83 fb 20             	cmp    $0x20,%ebx
  80137c:	75 ec                	jne    80136a <close_all+0x10>
}
  80137e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801381:	c9                   	leave  
  801382:	c3                   	ret    

00801383 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  801383:	f3 0f 1e fb          	endbr32 
  801387:	55                   	push   %ebp
  801388:	89 e5                	mov    %esp,%ebp
  80138a:	57                   	push   %edi
  80138b:	56                   	push   %esi
  80138c:	53                   	push   %ebx
  80138d:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  801390:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801393:	50                   	push   %eax
  801394:	ff 75 08             	pushl  0x8(%ebp)
  801397:	e8 54 fe ff ff       	call   8011f0 <fd_lookup>
  80139c:	89 c3                	mov    %eax,%ebx
  80139e:	83 c4 10             	add    $0x10,%esp
  8013a1:	85 c0                	test   %eax,%eax
  8013a3:	0f 88 81 00 00 00    	js     80142a <dup+0xa7>
		return r;
	close(newfdnum);
  8013a9:	83 ec 0c             	sub    $0xc,%esp
  8013ac:	ff 75 0c             	pushl  0xc(%ebp)
  8013af:	e8 75 ff ff ff       	call   801329 <close>

	newfd = INDEX2FD(newfdnum);
  8013b4:	8b 75 0c             	mov    0xc(%ebp),%esi
  8013b7:	c1 e6 0c             	shl    $0xc,%esi
  8013ba:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  8013c0:	83 c4 04             	add    $0x4,%esp
  8013c3:	ff 75 e4             	pushl  -0x1c(%ebp)
  8013c6:	e8 b4 fd ff ff       	call   80117f <fd2data>
  8013cb:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  8013cd:	89 34 24             	mov    %esi,(%esp)
  8013d0:	e8 aa fd ff ff       	call   80117f <fd2data>
  8013d5:	83 c4 10             	add    $0x10,%esp
  8013d8:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  8013da:	89 d8                	mov    %ebx,%eax
  8013dc:	c1 e8 16             	shr    $0x16,%eax
  8013df:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  8013e6:	a8 01                	test   $0x1,%al
  8013e8:	74 11                	je     8013fb <dup+0x78>
  8013ea:	89 d8                	mov    %ebx,%eax
  8013ec:	c1 e8 0c             	shr    $0xc,%eax
  8013ef:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  8013f6:	f6 c2 01             	test   $0x1,%dl
  8013f9:	75 39                	jne    801434 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  8013fb:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8013fe:	89 d0                	mov    %edx,%eax
  801400:	c1 e8 0c             	shr    $0xc,%eax
  801403:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80140a:	83 ec 0c             	sub    $0xc,%esp
  80140d:	25 07 0e 00 00       	and    $0xe07,%eax
  801412:	50                   	push   %eax
  801413:	56                   	push   %esi
  801414:	6a 00                	push   $0x0
  801416:	52                   	push   %edx
  801417:	6a 00                	push   $0x0
  801419:	e8 42 f8 ff ff       	call   800c60 <sys_page_map>
  80141e:	89 c3                	mov    %eax,%ebx
  801420:	83 c4 20             	add    $0x20,%esp
  801423:	85 c0                	test   %eax,%eax
  801425:	78 31                	js     801458 <dup+0xd5>
		goto err;

	return newfdnum;
  801427:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  80142a:	89 d8                	mov    %ebx,%eax
  80142c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80142f:	5b                   	pop    %ebx
  801430:	5e                   	pop    %esi
  801431:	5f                   	pop    %edi
  801432:	5d                   	pop    %ebp
  801433:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  801434:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80143b:	83 ec 0c             	sub    $0xc,%esp
  80143e:	25 07 0e 00 00       	and    $0xe07,%eax
  801443:	50                   	push   %eax
  801444:	57                   	push   %edi
  801445:	6a 00                	push   $0x0
  801447:	53                   	push   %ebx
  801448:	6a 00                	push   $0x0
  80144a:	e8 11 f8 ff ff       	call   800c60 <sys_page_map>
  80144f:	89 c3                	mov    %eax,%ebx
  801451:	83 c4 20             	add    $0x20,%esp
  801454:	85 c0                	test   %eax,%eax
  801456:	79 a3                	jns    8013fb <dup+0x78>
	sys_page_unmap(0, newfd);
  801458:	83 ec 08             	sub    $0x8,%esp
  80145b:	56                   	push   %esi
  80145c:	6a 00                	push   $0x0
  80145e:	e8 43 f8 ff ff       	call   800ca6 <sys_page_unmap>
	sys_page_unmap(0, nva);
  801463:	83 c4 08             	add    $0x8,%esp
  801466:	57                   	push   %edi
  801467:	6a 00                	push   $0x0
  801469:	e8 38 f8 ff ff       	call   800ca6 <sys_page_unmap>
	return r;
  80146e:	83 c4 10             	add    $0x10,%esp
  801471:	eb b7                	jmp    80142a <dup+0xa7>

00801473 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  801473:	f3 0f 1e fb          	endbr32 
  801477:	55                   	push   %ebp
  801478:	89 e5                	mov    %esp,%ebp
  80147a:	53                   	push   %ebx
  80147b:	83 ec 1c             	sub    $0x1c,%esp
  80147e:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801481:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801484:	50                   	push   %eax
  801485:	53                   	push   %ebx
  801486:	e8 65 fd ff ff       	call   8011f0 <fd_lookup>
  80148b:	83 c4 10             	add    $0x10,%esp
  80148e:	85 c0                	test   %eax,%eax
  801490:	78 3f                	js     8014d1 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801492:	83 ec 08             	sub    $0x8,%esp
  801495:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801498:	50                   	push   %eax
  801499:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80149c:	ff 30                	pushl  (%eax)
  80149e:	e8 a1 fd ff ff       	call   801244 <dev_lookup>
  8014a3:	83 c4 10             	add    $0x10,%esp
  8014a6:	85 c0                	test   %eax,%eax
  8014a8:	78 27                	js     8014d1 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  8014aa:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8014ad:	8b 42 08             	mov    0x8(%edx),%eax
  8014b0:	83 e0 03             	and    $0x3,%eax
  8014b3:	83 f8 01             	cmp    $0x1,%eax
  8014b6:	74 1e                	je     8014d6 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  8014b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8014bb:	8b 40 08             	mov    0x8(%eax),%eax
  8014be:	85 c0                	test   %eax,%eax
  8014c0:	74 35                	je     8014f7 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  8014c2:	83 ec 04             	sub    $0x4,%esp
  8014c5:	ff 75 10             	pushl  0x10(%ebp)
  8014c8:	ff 75 0c             	pushl  0xc(%ebp)
  8014cb:	52                   	push   %edx
  8014cc:	ff d0                	call   *%eax
  8014ce:	83 c4 10             	add    $0x10,%esp
}
  8014d1:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8014d4:	c9                   	leave  
  8014d5:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  8014d6:	a1 04 40 80 00       	mov    0x804004,%eax
  8014db:	8b 40 48             	mov    0x48(%eax),%eax
  8014de:	83 ec 04             	sub    $0x4,%esp
  8014e1:	53                   	push   %ebx
  8014e2:	50                   	push   %eax
  8014e3:	68 3d 28 80 00       	push   $0x80283d
  8014e8:	e8 11 ed ff ff       	call   8001fe <cprintf>
		return -E_INVAL;
  8014ed:	83 c4 10             	add    $0x10,%esp
  8014f0:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8014f5:	eb da                	jmp    8014d1 <read+0x5e>
		return -E_NOT_SUPP;
  8014f7:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8014fc:	eb d3                	jmp    8014d1 <read+0x5e>

008014fe <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  8014fe:	f3 0f 1e fb          	endbr32 
  801502:	55                   	push   %ebp
  801503:	89 e5                	mov    %esp,%ebp
  801505:	57                   	push   %edi
  801506:	56                   	push   %esi
  801507:	53                   	push   %ebx
  801508:	83 ec 0c             	sub    $0xc,%esp
  80150b:	8b 7d 08             	mov    0x8(%ebp),%edi
  80150e:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  801511:	bb 00 00 00 00       	mov    $0x0,%ebx
  801516:	eb 02                	jmp    80151a <readn+0x1c>
  801518:	01 c3                	add    %eax,%ebx
  80151a:	39 f3                	cmp    %esi,%ebx
  80151c:	73 21                	jae    80153f <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  80151e:	83 ec 04             	sub    $0x4,%esp
  801521:	89 f0                	mov    %esi,%eax
  801523:	29 d8                	sub    %ebx,%eax
  801525:	50                   	push   %eax
  801526:	89 d8                	mov    %ebx,%eax
  801528:	03 45 0c             	add    0xc(%ebp),%eax
  80152b:	50                   	push   %eax
  80152c:	57                   	push   %edi
  80152d:	e8 41 ff ff ff       	call   801473 <read>
		if (m < 0)
  801532:	83 c4 10             	add    $0x10,%esp
  801535:	85 c0                	test   %eax,%eax
  801537:	78 04                	js     80153d <readn+0x3f>
			return m;
		if (m == 0)
  801539:	75 dd                	jne    801518 <readn+0x1a>
  80153b:	eb 02                	jmp    80153f <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  80153d:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  80153f:	89 d8                	mov    %ebx,%eax
  801541:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801544:	5b                   	pop    %ebx
  801545:	5e                   	pop    %esi
  801546:	5f                   	pop    %edi
  801547:	5d                   	pop    %ebp
  801548:	c3                   	ret    

00801549 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801549:	f3 0f 1e fb          	endbr32 
  80154d:	55                   	push   %ebp
  80154e:	89 e5                	mov    %esp,%ebp
  801550:	53                   	push   %ebx
  801551:	83 ec 1c             	sub    $0x1c,%esp
  801554:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801557:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80155a:	50                   	push   %eax
  80155b:	53                   	push   %ebx
  80155c:	e8 8f fc ff ff       	call   8011f0 <fd_lookup>
  801561:	83 c4 10             	add    $0x10,%esp
  801564:	85 c0                	test   %eax,%eax
  801566:	78 3a                	js     8015a2 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801568:	83 ec 08             	sub    $0x8,%esp
  80156b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80156e:	50                   	push   %eax
  80156f:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801572:	ff 30                	pushl  (%eax)
  801574:	e8 cb fc ff ff       	call   801244 <dev_lookup>
  801579:	83 c4 10             	add    $0x10,%esp
  80157c:	85 c0                	test   %eax,%eax
  80157e:	78 22                	js     8015a2 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801580:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801583:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801587:	74 1e                	je     8015a7 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801589:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80158c:	8b 52 0c             	mov    0xc(%edx),%edx
  80158f:	85 d2                	test   %edx,%edx
  801591:	74 35                	je     8015c8 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  801593:	83 ec 04             	sub    $0x4,%esp
  801596:	ff 75 10             	pushl  0x10(%ebp)
  801599:	ff 75 0c             	pushl  0xc(%ebp)
  80159c:	50                   	push   %eax
  80159d:	ff d2                	call   *%edx
  80159f:	83 c4 10             	add    $0x10,%esp
}
  8015a2:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8015a5:	c9                   	leave  
  8015a6:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  8015a7:	a1 04 40 80 00       	mov    0x804004,%eax
  8015ac:	8b 40 48             	mov    0x48(%eax),%eax
  8015af:	83 ec 04             	sub    $0x4,%esp
  8015b2:	53                   	push   %ebx
  8015b3:	50                   	push   %eax
  8015b4:	68 59 28 80 00       	push   $0x802859
  8015b9:	e8 40 ec ff ff       	call   8001fe <cprintf>
		return -E_INVAL;
  8015be:	83 c4 10             	add    $0x10,%esp
  8015c1:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8015c6:	eb da                	jmp    8015a2 <write+0x59>
		return -E_NOT_SUPP;
  8015c8:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8015cd:	eb d3                	jmp    8015a2 <write+0x59>

008015cf <seek>:

int
seek(int fdnum, off_t offset)
{
  8015cf:	f3 0f 1e fb          	endbr32 
  8015d3:	55                   	push   %ebp
  8015d4:	89 e5                	mov    %esp,%ebp
  8015d6:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8015d9:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015dc:	50                   	push   %eax
  8015dd:	ff 75 08             	pushl  0x8(%ebp)
  8015e0:	e8 0b fc ff ff       	call   8011f0 <fd_lookup>
  8015e5:	83 c4 10             	add    $0x10,%esp
  8015e8:	85 c0                	test   %eax,%eax
  8015ea:	78 0e                	js     8015fa <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  8015ec:	8b 55 0c             	mov    0xc(%ebp),%edx
  8015ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8015f2:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  8015f5:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8015fa:	c9                   	leave  
  8015fb:	c3                   	ret    

008015fc <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  8015fc:	f3 0f 1e fb          	endbr32 
  801600:	55                   	push   %ebp
  801601:	89 e5                	mov    %esp,%ebp
  801603:	53                   	push   %ebx
  801604:	83 ec 1c             	sub    $0x1c,%esp
  801607:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  80160a:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80160d:	50                   	push   %eax
  80160e:	53                   	push   %ebx
  80160f:	e8 dc fb ff ff       	call   8011f0 <fd_lookup>
  801614:	83 c4 10             	add    $0x10,%esp
  801617:	85 c0                	test   %eax,%eax
  801619:	78 37                	js     801652 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80161b:	83 ec 08             	sub    $0x8,%esp
  80161e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801621:	50                   	push   %eax
  801622:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801625:	ff 30                	pushl  (%eax)
  801627:	e8 18 fc ff ff       	call   801244 <dev_lookup>
  80162c:	83 c4 10             	add    $0x10,%esp
  80162f:	85 c0                	test   %eax,%eax
  801631:	78 1f                	js     801652 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801633:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801636:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  80163a:	74 1b                	je     801657 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  80163c:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80163f:	8b 52 18             	mov    0x18(%edx),%edx
  801642:	85 d2                	test   %edx,%edx
  801644:	74 32                	je     801678 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  801646:	83 ec 08             	sub    $0x8,%esp
  801649:	ff 75 0c             	pushl  0xc(%ebp)
  80164c:	50                   	push   %eax
  80164d:	ff d2                	call   *%edx
  80164f:	83 c4 10             	add    $0x10,%esp
}
  801652:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801655:	c9                   	leave  
  801656:	c3                   	ret    
			thisenv->env_id, fdnum);
  801657:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  80165c:	8b 40 48             	mov    0x48(%eax),%eax
  80165f:	83 ec 04             	sub    $0x4,%esp
  801662:	53                   	push   %ebx
  801663:	50                   	push   %eax
  801664:	68 1c 28 80 00       	push   $0x80281c
  801669:	e8 90 eb ff ff       	call   8001fe <cprintf>
		return -E_INVAL;
  80166e:	83 c4 10             	add    $0x10,%esp
  801671:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801676:	eb da                	jmp    801652 <ftruncate+0x56>
		return -E_NOT_SUPP;
  801678:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80167d:	eb d3                	jmp    801652 <ftruncate+0x56>

0080167f <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  80167f:	f3 0f 1e fb          	endbr32 
  801683:	55                   	push   %ebp
  801684:	89 e5                	mov    %esp,%ebp
  801686:	53                   	push   %ebx
  801687:	83 ec 1c             	sub    $0x1c,%esp
  80168a:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80168d:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801690:	50                   	push   %eax
  801691:	ff 75 08             	pushl  0x8(%ebp)
  801694:	e8 57 fb ff ff       	call   8011f0 <fd_lookup>
  801699:	83 c4 10             	add    $0x10,%esp
  80169c:	85 c0                	test   %eax,%eax
  80169e:	78 4b                	js     8016eb <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8016a0:	83 ec 08             	sub    $0x8,%esp
  8016a3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8016a6:	50                   	push   %eax
  8016a7:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016aa:	ff 30                	pushl  (%eax)
  8016ac:	e8 93 fb ff ff       	call   801244 <dev_lookup>
  8016b1:	83 c4 10             	add    $0x10,%esp
  8016b4:	85 c0                	test   %eax,%eax
  8016b6:	78 33                	js     8016eb <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  8016b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8016bb:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  8016bf:	74 2f                	je     8016f0 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  8016c1:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  8016c4:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  8016cb:	00 00 00 
	stat->st_isdir = 0;
  8016ce:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8016d5:	00 00 00 
	stat->st_dev = dev;
  8016d8:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  8016de:	83 ec 08             	sub    $0x8,%esp
  8016e1:	53                   	push   %ebx
  8016e2:	ff 75 f0             	pushl  -0x10(%ebp)
  8016e5:	ff 50 14             	call   *0x14(%eax)
  8016e8:	83 c4 10             	add    $0x10,%esp
}
  8016eb:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8016ee:	c9                   	leave  
  8016ef:	c3                   	ret    
		return -E_NOT_SUPP;
  8016f0:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8016f5:	eb f4                	jmp    8016eb <fstat+0x6c>

008016f7 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  8016f7:	f3 0f 1e fb          	endbr32 
  8016fb:	55                   	push   %ebp
  8016fc:	89 e5                	mov    %esp,%ebp
  8016fe:	56                   	push   %esi
  8016ff:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  801700:	83 ec 08             	sub    $0x8,%esp
  801703:	6a 00                	push   $0x0
  801705:	ff 75 08             	pushl  0x8(%ebp)
  801708:	e8 fb 01 00 00       	call   801908 <open>
  80170d:	89 c3                	mov    %eax,%ebx
  80170f:	83 c4 10             	add    $0x10,%esp
  801712:	85 c0                	test   %eax,%eax
  801714:	78 1b                	js     801731 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  801716:	83 ec 08             	sub    $0x8,%esp
  801719:	ff 75 0c             	pushl  0xc(%ebp)
  80171c:	50                   	push   %eax
  80171d:	e8 5d ff ff ff       	call   80167f <fstat>
  801722:	89 c6                	mov    %eax,%esi
	close(fd);
  801724:	89 1c 24             	mov    %ebx,(%esp)
  801727:	e8 fd fb ff ff       	call   801329 <close>
	return r;
  80172c:	83 c4 10             	add    $0x10,%esp
  80172f:	89 f3                	mov    %esi,%ebx
}
  801731:	89 d8                	mov    %ebx,%eax
  801733:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801736:	5b                   	pop    %ebx
  801737:	5e                   	pop    %esi
  801738:	5d                   	pop    %ebp
  801739:	c3                   	ret    

0080173a <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  80173a:	55                   	push   %ebp
  80173b:	89 e5                	mov    %esp,%ebp
  80173d:	56                   	push   %esi
  80173e:	53                   	push   %ebx
  80173f:	89 c6                	mov    %eax,%esi
  801741:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  801743:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  80174a:	74 27                	je     801773 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  80174c:	6a 07                	push   $0x7
  80174e:	68 00 50 80 00       	push   $0x805000
  801753:	56                   	push   %esi
  801754:	ff 35 00 40 80 00    	pushl  0x804000
  80175a:	e8 bd 08 00 00       	call   80201c <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  80175f:	83 c4 0c             	add    $0xc,%esp
  801762:	6a 00                	push   $0x0
  801764:	53                   	push   %ebx
  801765:	6a 00                	push   $0x0
  801767:	e8 2f 08 00 00       	call   801f9b <ipc_recv>
}
  80176c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80176f:	5b                   	pop    %ebx
  801770:	5e                   	pop    %esi
  801771:	5d                   	pop    %ebp
  801772:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  801773:	83 ec 0c             	sub    $0xc,%esp
  801776:	6a 01                	push   $0x1
  801778:	e8 f7 08 00 00       	call   802074 <ipc_find_env>
  80177d:	a3 00 40 80 00       	mov    %eax,0x804000
  801782:	83 c4 10             	add    $0x10,%esp
  801785:	eb c5                	jmp    80174c <fsipc+0x12>

00801787 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801787:	f3 0f 1e fb          	endbr32 
  80178b:	55                   	push   %ebp
  80178c:	89 e5                	mov    %esp,%ebp
  80178e:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  801791:	8b 45 08             	mov    0x8(%ebp),%eax
  801794:	8b 40 0c             	mov    0xc(%eax),%eax
  801797:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  80179c:	8b 45 0c             	mov    0xc(%ebp),%eax
  80179f:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  8017a4:	ba 00 00 00 00       	mov    $0x0,%edx
  8017a9:	b8 02 00 00 00       	mov    $0x2,%eax
  8017ae:	e8 87 ff ff ff       	call   80173a <fsipc>
}
  8017b3:	c9                   	leave  
  8017b4:	c3                   	ret    

008017b5 <devfile_flush>:
{
  8017b5:	f3 0f 1e fb          	endbr32 
  8017b9:	55                   	push   %ebp
  8017ba:	89 e5                	mov    %esp,%ebp
  8017bc:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  8017bf:	8b 45 08             	mov    0x8(%ebp),%eax
  8017c2:	8b 40 0c             	mov    0xc(%eax),%eax
  8017c5:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  8017ca:	ba 00 00 00 00       	mov    $0x0,%edx
  8017cf:	b8 06 00 00 00       	mov    $0x6,%eax
  8017d4:	e8 61 ff ff ff       	call   80173a <fsipc>
}
  8017d9:	c9                   	leave  
  8017da:	c3                   	ret    

008017db <devfile_stat>:
{
  8017db:	f3 0f 1e fb          	endbr32 
  8017df:	55                   	push   %ebp
  8017e0:	89 e5                	mov    %esp,%ebp
  8017e2:	53                   	push   %ebx
  8017e3:	83 ec 04             	sub    $0x4,%esp
  8017e6:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  8017e9:	8b 45 08             	mov    0x8(%ebp),%eax
  8017ec:	8b 40 0c             	mov    0xc(%eax),%eax
  8017ef:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  8017f4:	ba 00 00 00 00       	mov    $0x0,%edx
  8017f9:	b8 05 00 00 00       	mov    $0x5,%eax
  8017fe:	e8 37 ff ff ff       	call   80173a <fsipc>
  801803:	85 c0                	test   %eax,%eax
  801805:	78 2c                	js     801833 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801807:	83 ec 08             	sub    $0x8,%esp
  80180a:	68 00 50 80 00       	push   $0x805000
  80180f:	53                   	push   %ebx
  801810:	e8 c2 ef ff ff       	call   8007d7 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  801815:	a1 80 50 80 00       	mov    0x805080,%eax
  80181a:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801820:	a1 84 50 80 00       	mov    0x805084,%eax
  801825:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  80182b:	83 c4 10             	add    $0x10,%esp
  80182e:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801833:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801836:	c9                   	leave  
  801837:	c3                   	ret    

00801838 <devfile_write>:
{
  801838:	f3 0f 1e fb          	endbr32 
  80183c:	55                   	push   %ebp
  80183d:	89 e5                	mov    %esp,%ebp
  80183f:	83 ec 0c             	sub    $0xc,%esp
  801842:	8b 45 10             	mov    0x10(%ebp),%eax
  801845:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  80184a:	ba f8 0f 00 00       	mov    $0xff8,%edx
  80184f:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  801852:	8b 55 08             	mov    0x8(%ebp),%edx
  801855:	8b 52 0c             	mov    0xc(%edx),%edx
  801858:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  80185e:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  801863:	50                   	push   %eax
  801864:	ff 75 0c             	pushl  0xc(%ebp)
  801867:	68 08 50 80 00       	push   $0x805008
  80186c:	e8 1c f1 ff ff       	call   80098d <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  801871:	ba 00 00 00 00       	mov    $0x0,%edx
  801876:	b8 04 00 00 00       	mov    $0x4,%eax
  80187b:	e8 ba fe ff ff       	call   80173a <fsipc>
  801880:	c9                   	leave  
  801881:	c3                   	ret    

00801882 <devfile_read>:
{
  801882:	f3 0f 1e fb          	endbr32 
  801886:	55                   	push   %ebp
  801887:	89 e5                	mov    %esp,%ebp
  801889:	56                   	push   %esi
  80188a:	53                   	push   %ebx
  80188b:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  80188e:	8b 45 08             	mov    0x8(%ebp),%eax
  801891:	8b 40 0c             	mov    0xc(%eax),%eax
  801894:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801899:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  80189f:	ba 00 00 00 00       	mov    $0x0,%edx
  8018a4:	b8 03 00 00 00       	mov    $0x3,%eax
  8018a9:	e8 8c fe ff ff       	call   80173a <fsipc>
  8018ae:	89 c3                	mov    %eax,%ebx
  8018b0:	85 c0                	test   %eax,%eax
  8018b2:	78 1f                	js     8018d3 <devfile_read+0x51>
	assert(r <= n);
  8018b4:	39 f0                	cmp    %esi,%eax
  8018b6:	77 24                	ja     8018dc <devfile_read+0x5a>
	assert(r <= PGSIZE);
  8018b8:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8018bd:	7f 33                	jg     8018f2 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  8018bf:	83 ec 04             	sub    $0x4,%esp
  8018c2:	50                   	push   %eax
  8018c3:	68 00 50 80 00       	push   $0x805000
  8018c8:	ff 75 0c             	pushl  0xc(%ebp)
  8018cb:	e8 bd f0 ff ff       	call   80098d <memmove>
	return r;
  8018d0:	83 c4 10             	add    $0x10,%esp
}
  8018d3:	89 d8                	mov    %ebx,%eax
  8018d5:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8018d8:	5b                   	pop    %ebx
  8018d9:	5e                   	pop    %esi
  8018da:	5d                   	pop    %ebp
  8018db:	c3                   	ret    
	assert(r <= n);
  8018dc:	68 88 28 80 00       	push   $0x802888
  8018e1:	68 8f 28 80 00       	push   $0x80288f
  8018e6:	6a 7c                	push   $0x7c
  8018e8:	68 a4 28 80 00       	push   $0x8028a4
  8018ed:	e8 be 05 00 00       	call   801eb0 <_panic>
	assert(r <= PGSIZE);
  8018f2:	68 af 28 80 00       	push   $0x8028af
  8018f7:	68 8f 28 80 00       	push   $0x80288f
  8018fc:	6a 7d                	push   $0x7d
  8018fe:	68 a4 28 80 00       	push   $0x8028a4
  801903:	e8 a8 05 00 00       	call   801eb0 <_panic>

00801908 <open>:
{
  801908:	f3 0f 1e fb          	endbr32 
  80190c:	55                   	push   %ebp
  80190d:	89 e5                	mov    %esp,%ebp
  80190f:	56                   	push   %esi
  801910:	53                   	push   %ebx
  801911:	83 ec 1c             	sub    $0x1c,%esp
  801914:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801917:	56                   	push   %esi
  801918:	e8 77 ee ff ff       	call   800794 <strlen>
  80191d:	83 c4 10             	add    $0x10,%esp
  801920:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801925:	7f 6c                	jg     801993 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801927:	83 ec 0c             	sub    $0xc,%esp
  80192a:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80192d:	50                   	push   %eax
  80192e:	e8 67 f8 ff ff       	call   80119a <fd_alloc>
  801933:	89 c3                	mov    %eax,%ebx
  801935:	83 c4 10             	add    $0x10,%esp
  801938:	85 c0                	test   %eax,%eax
  80193a:	78 3c                	js     801978 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  80193c:	83 ec 08             	sub    $0x8,%esp
  80193f:	56                   	push   %esi
  801940:	68 00 50 80 00       	push   $0x805000
  801945:	e8 8d ee ff ff       	call   8007d7 <strcpy>
	fsipcbuf.open.req_omode = mode;
  80194a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80194d:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801952:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801955:	b8 01 00 00 00       	mov    $0x1,%eax
  80195a:	e8 db fd ff ff       	call   80173a <fsipc>
  80195f:	89 c3                	mov    %eax,%ebx
  801961:	83 c4 10             	add    $0x10,%esp
  801964:	85 c0                	test   %eax,%eax
  801966:	78 19                	js     801981 <open+0x79>
	return fd2num(fd);
  801968:	83 ec 0c             	sub    $0xc,%esp
  80196b:	ff 75 f4             	pushl  -0xc(%ebp)
  80196e:	e8 f8 f7 ff ff       	call   80116b <fd2num>
  801973:	89 c3                	mov    %eax,%ebx
  801975:	83 c4 10             	add    $0x10,%esp
}
  801978:	89 d8                	mov    %ebx,%eax
  80197a:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80197d:	5b                   	pop    %ebx
  80197e:	5e                   	pop    %esi
  80197f:	5d                   	pop    %ebp
  801980:	c3                   	ret    
		fd_close(fd, 0);
  801981:	83 ec 08             	sub    $0x8,%esp
  801984:	6a 00                	push   $0x0
  801986:	ff 75 f4             	pushl  -0xc(%ebp)
  801989:	e8 10 f9 ff ff       	call   80129e <fd_close>
		return r;
  80198e:	83 c4 10             	add    $0x10,%esp
  801991:	eb e5                	jmp    801978 <open+0x70>
		return -E_BAD_PATH;
  801993:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801998:	eb de                	jmp    801978 <open+0x70>

0080199a <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  80199a:	f3 0f 1e fb          	endbr32 
  80199e:	55                   	push   %ebp
  80199f:	89 e5                	mov    %esp,%ebp
  8019a1:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  8019a4:	ba 00 00 00 00       	mov    $0x0,%edx
  8019a9:	b8 08 00 00 00       	mov    $0x8,%eax
  8019ae:	e8 87 fd ff ff       	call   80173a <fsipc>
}
  8019b3:	c9                   	leave  
  8019b4:	c3                   	ret    

008019b5 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  8019b5:	f3 0f 1e fb          	endbr32 
  8019b9:	55                   	push   %ebp
  8019ba:	89 e5                	mov    %esp,%ebp
  8019bc:	56                   	push   %esi
  8019bd:	53                   	push   %ebx
  8019be:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  8019c1:	83 ec 0c             	sub    $0xc,%esp
  8019c4:	ff 75 08             	pushl  0x8(%ebp)
  8019c7:	e8 b3 f7 ff ff       	call   80117f <fd2data>
  8019cc:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  8019ce:	83 c4 08             	add    $0x8,%esp
  8019d1:	68 bb 28 80 00       	push   $0x8028bb
  8019d6:	53                   	push   %ebx
  8019d7:	e8 fb ed ff ff       	call   8007d7 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  8019dc:	8b 46 04             	mov    0x4(%esi),%eax
  8019df:	2b 06                	sub    (%esi),%eax
  8019e1:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  8019e7:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8019ee:	00 00 00 
	stat->st_dev = &devpipe;
  8019f1:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  8019f8:	30 80 00 
	return 0;
}
  8019fb:	b8 00 00 00 00       	mov    $0x0,%eax
  801a00:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801a03:	5b                   	pop    %ebx
  801a04:	5e                   	pop    %esi
  801a05:	5d                   	pop    %ebp
  801a06:	c3                   	ret    

00801a07 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801a07:	f3 0f 1e fb          	endbr32 
  801a0b:	55                   	push   %ebp
  801a0c:	89 e5                	mov    %esp,%ebp
  801a0e:	53                   	push   %ebx
  801a0f:	83 ec 0c             	sub    $0xc,%esp
  801a12:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801a15:	53                   	push   %ebx
  801a16:	6a 00                	push   $0x0
  801a18:	e8 89 f2 ff ff       	call   800ca6 <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801a1d:	89 1c 24             	mov    %ebx,(%esp)
  801a20:	e8 5a f7 ff ff       	call   80117f <fd2data>
  801a25:	83 c4 08             	add    $0x8,%esp
  801a28:	50                   	push   %eax
  801a29:	6a 00                	push   $0x0
  801a2b:	e8 76 f2 ff ff       	call   800ca6 <sys_page_unmap>
}
  801a30:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801a33:	c9                   	leave  
  801a34:	c3                   	ret    

00801a35 <_pipeisclosed>:
{
  801a35:	55                   	push   %ebp
  801a36:	89 e5                	mov    %esp,%ebp
  801a38:	57                   	push   %edi
  801a39:	56                   	push   %esi
  801a3a:	53                   	push   %ebx
  801a3b:	83 ec 1c             	sub    $0x1c,%esp
  801a3e:	89 c7                	mov    %eax,%edi
  801a40:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801a42:	a1 04 40 80 00       	mov    0x804004,%eax
  801a47:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801a4a:	83 ec 0c             	sub    $0xc,%esp
  801a4d:	57                   	push   %edi
  801a4e:	e8 5e 06 00 00       	call   8020b1 <pageref>
  801a53:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801a56:	89 34 24             	mov    %esi,(%esp)
  801a59:	e8 53 06 00 00       	call   8020b1 <pageref>
		nn = thisenv->env_runs;
  801a5e:	8b 15 04 40 80 00    	mov    0x804004,%edx
  801a64:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801a67:	83 c4 10             	add    $0x10,%esp
  801a6a:	39 cb                	cmp    %ecx,%ebx
  801a6c:	74 1b                	je     801a89 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801a6e:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801a71:	75 cf                	jne    801a42 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801a73:	8b 42 58             	mov    0x58(%edx),%eax
  801a76:	6a 01                	push   $0x1
  801a78:	50                   	push   %eax
  801a79:	53                   	push   %ebx
  801a7a:	68 c2 28 80 00       	push   $0x8028c2
  801a7f:	e8 7a e7 ff ff       	call   8001fe <cprintf>
  801a84:	83 c4 10             	add    $0x10,%esp
  801a87:	eb b9                	jmp    801a42 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801a89:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801a8c:	0f 94 c0             	sete   %al
  801a8f:	0f b6 c0             	movzbl %al,%eax
}
  801a92:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801a95:	5b                   	pop    %ebx
  801a96:	5e                   	pop    %esi
  801a97:	5f                   	pop    %edi
  801a98:	5d                   	pop    %ebp
  801a99:	c3                   	ret    

00801a9a <devpipe_write>:
{
  801a9a:	f3 0f 1e fb          	endbr32 
  801a9e:	55                   	push   %ebp
  801a9f:	89 e5                	mov    %esp,%ebp
  801aa1:	57                   	push   %edi
  801aa2:	56                   	push   %esi
  801aa3:	53                   	push   %ebx
  801aa4:	83 ec 28             	sub    $0x28,%esp
  801aa7:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801aaa:	56                   	push   %esi
  801aab:	e8 cf f6 ff ff       	call   80117f <fd2data>
  801ab0:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801ab2:	83 c4 10             	add    $0x10,%esp
  801ab5:	bf 00 00 00 00       	mov    $0x0,%edi
  801aba:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801abd:	74 4f                	je     801b0e <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801abf:	8b 43 04             	mov    0x4(%ebx),%eax
  801ac2:	8b 0b                	mov    (%ebx),%ecx
  801ac4:	8d 51 20             	lea    0x20(%ecx),%edx
  801ac7:	39 d0                	cmp    %edx,%eax
  801ac9:	72 14                	jb     801adf <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801acb:	89 da                	mov    %ebx,%edx
  801acd:	89 f0                	mov    %esi,%eax
  801acf:	e8 61 ff ff ff       	call   801a35 <_pipeisclosed>
  801ad4:	85 c0                	test   %eax,%eax
  801ad6:	75 3b                	jne    801b13 <devpipe_write+0x79>
			sys_yield();
  801ad8:	e8 19 f1 ff ff       	call   800bf6 <sys_yield>
  801add:	eb e0                	jmp    801abf <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801adf:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801ae2:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801ae6:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801ae9:	89 c2                	mov    %eax,%edx
  801aeb:	c1 fa 1f             	sar    $0x1f,%edx
  801aee:	89 d1                	mov    %edx,%ecx
  801af0:	c1 e9 1b             	shr    $0x1b,%ecx
  801af3:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801af6:	83 e2 1f             	and    $0x1f,%edx
  801af9:	29 ca                	sub    %ecx,%edx
  801afb:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801aff:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801b03:	83 c0 01             	add    $0x1,%eax
  801b06:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801b09:	83 c7 01             	add    $0x1,%edi
  801b0c:	eb ac                	jmp    801aba <devpipe_write+0x20>
	return i;
  801b0e:	8b 45 10             	mov    0x10(%ebp),%eax
  801b11:	eb 05                	jmp    801b18 <devpipe_write+0x7e>
				return 0;
  801b13:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801b18:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b1b:	5b                   	pop    %ebx
  801b1c:	5e                   	pop    %esi
  801b1d:	5f                   	pop    %edi
  801b1e:	5d                   	pop    %ebp
  801b1f:	c3                   	ret    

00801b20 <devpipe_read>:
{
  801b20:	f3 0f 1e fb          	endbr32 
  801b24:	55                   	push   %ebp
  801b25:	89 e5                	mov    %esp,%ebp
  801b27:	57                   	push   %edi
  801b28:	56                   	push   %esi
  801b29:	53                   	push   %ebx
  801b2a:	83 ec 18             	sub    $0x18,%esp
  801b2d:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801b30:	57                   	push   %edi
  801b31:	e8 49 f6 ff ff       	call   80117f <fd2data>
  801b36:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801b38:	83 c4 10             	add    $0x10,%esp
  801b3b:	be 00 00 00 00       	mov    $0x0,%esi
  801b40:	3b 75 10             	cmp    0x10(%ebp),%esi
  801b43:	75 14                	jne    801b59 <devpipe_read+0x39>
	return i;
  801b45:	8b 45 10             	mov    0x10(%ebp),%eax
  801b48:	eb 02                	jmp    801b4c <devpipe_read+0x2c>
				return i;
  801b4a:	89 f0                	mov    %esi,%eax
}
  801b4c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b4f:	5b                   	pop    %ebx
  801b50:	5e                   	pop    %esi
  801b51:	5f                   	pop    %edi
  801b52:	5d                   	pop    %ebp
  801b53:	c3                   	ret    
			sys_yield();
  801b54:	e8 9d f0 ff ff       	call   800bf6 <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801b59:	8b 03                	mov    (%ebx),%eax
  801b5b:	3b 43 04             	cmp    0x4(%ebx),%eax
  801b5e:	75 18                	jne    801b78 <devpipe_read+0x58>
			if (i > 0)
  801b60:	85 f6                	test   %esi,%esi
  801b62:	75 e6                	jne    801b4a <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801b64:	89 da                	mov    %ebx,%edx
  801b66:	89 f8                	mov    %edi,%eax
  801b68:	e8 c8 fe ff ff       	call   801a35 <_pipeisclosed>
  801b6d:	85 c0                	test   %eax,%eax
  801b6f:	74 e3                	je     801b54 <devpipe_read+0x34>
				return 0;
  801b71:	b8 00 00 00 00       	mov    $0x0,%eax
  801b76:	eb d4                	jmp    801b4c <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801b78:	99                   	cltd   
  801b79:	c1 ea 1b             	shr    $0x1b,%edx
  801b7c:	01 d0                	add    %edx,%eax
  801b7e:	83 e0 1f             	and    $0x1f,%eax
  801b81:	29 d0                	sub    %edx,%eax
  801b83:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801b88:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801b8b:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801b8e:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801b91:	83 c6 01             	add    $0x1,%esi
  801b94:	eb aa                	jmp    801b40 <devpipe_read+0x20>

00801b96 <pipe>:
{
  801b96:	f3 0f 1e fb          	endbr32 
  801b9a:	55                   	push   %ebp
  801b9b:	89 e5                	mov    %esp,%ebp
  801b9d:	56                   	push   %esi
  801b9e:	53                   	push   %ebx
  801b9f:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801ba2:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801ba5:	50                   	push   %eax
  801ba6:	e8 ef f5 ff ff       	call   80119a <fd_alloc>
  801bab:	89 c3                	mov    %eax,%ebx
  801bad:	83 c4 10             	add    $0x10,%esp
  801bb0:	85 c0                	test   %eax,%eax
  801bb2:	0f 88 23 01 00 00    	js     801cdb <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801bb8:	83 ec 04             	sub    $0x4,%esp
  801bbb:	68 07 04 00 00       	push   $0x407
  801bc0:	ff 75 f4             	pushl  -0xc(%ebp)
  801bc3:	6a 00                	push   $0x0
  801bc5:	e8 4f f0 ff ff       	call   800c19 <sys_page_alloc>
  801bca:	89 c3                	mov    %eax,%ebx
  801bcc:	83 c4 10             	add    $0x10,%esp
  801bcf:	85 c0                	test   %eax,%eax
  801bd1:	0f 88 04 01 00 00    	js     801cdb <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801bd7:	83 ec 0c             	sub    $0xc,%esp
  801bda:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801bdd:	50                   	push   %eax
  801bde:	e8 b7 f5 ff ff       	call   80119a <fd_alloc>
  801be3:	89 c3                	mov    %eax,%ebx
  801be5:	83 c4 10             	add    $0x10,%esp
  801be8:	85 c0                	test   %eax,%eax
  801bea:	0f 88 db 00 00 00    	js     801ccb <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801bf0:	83 ec 04             	sub    $0x4,%esp
  801bf3:	68 07 04 00 00       	push   $0x407
  801bf8:	ff 75 f0             	pushl  -0x10(%ebp)
  801bfb:	6a 00                	push   $0x0
  801bfd:	e8 17 f0 ff ff       	call   800c19 <sys_page_alloc>
  801c02:	89 c3                	mov    %eax,%ebx
  801c04:	83 c4 10             	add    $0x10,%esp
  801c07:	85 c0                	test   %eax,%eax
  801c09:	0f 88 bc 00 00 00    	js     801ccb <pipe+0x135>
	va = fd2data(fd0);
  801c0f:	83 ec 0c             	sub    $0xc,%esp
  801c12:	ff 75 f4             	pushl  -0xc(%ebp)
  801c15:	e8 65 f5 ff ff       	call   80117f <fd2data>
  801c1a:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801c1c:	83 c4 0c             	add    $0xc,%esp
  801c1f:	68 07 04 00 00       	push   $0x407
  801c24:	50                   	push   %eax
  801c25:	6a 00                	push   $0x0
  801c27:	e8 ed ef ff ff       	call   800c19 <sys_page_alloc>
  801c2c:	89 c3                	mov    %eax,%ebx
  801c2e:	83 c4 10             	add    $0x10,%esp
  801c31:	85 c0                	test   %eax,%eax
  801c33:	0f 88 82 00 00 00    	js     801cbb <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801c39:	83 ec 0c             	sub    $0xc,%esp
  801c3c:	ff 75 f0             	pushl  -0x10(%ebp)
  801c3f:	e8 3b f5 ff ff       	call   80117f <fd2data>
  801c44:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801c4b:	50                   	push   %eax
  801c4c:	6a 00                	push   $0x0
  801c4e:	56                   	push   %esi
  801c4f:	6a 00                	push   $0x0
  801c51:	e8 0a f0 ff ff       	call   800c60 <sys_page_map>
  801c56:	89 c3                	mov    %eax,%ebx
  801c58:	83 c4 20             	add    $0x20,%esp
  801c5b:	85 c0                	test   %eax,%eax
  801c5d:	78 4e                	js     801cad <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801c5f:	a1 20 30 80 00       	mov    0x803020,%eax
  801c64:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801c67:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801c69:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801c6c:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801c73:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801c76:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801c78:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801c7b:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801c82:	83 ec 0c             	sub    $0xc,%esp
  801c85:	ff 75 f4             	pushl  -0xc(%ebp)
  801c88:	e8 de f4 ff ff       	call   80116b <fd2num>
  801c8d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801c90:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801c92:	83 c4 04             	add    $0x4,%esp
  801c95:	ff 75 f0             	pushl  -0x10(%ebp)
  801c98:	e8 ce f4 ff ff       	call   80116b <fd2num>
  801c9d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801ca0:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801ca3:	83 c4 10             	add    $0x10,%esp
  801ca6:	bb 00 00 00 00       	mov    $0x0,%ebx
  801cab:	eb 2e                	jmp    801cdb <pipe+0x145>
	sys_page_unmap(0, va);
  801cad:	83 ec 08             	sub    $0x8,%esp
  801cb0:	56                   	push   %esi
  801cb1:	6a 00                	push   $0x0
  801cb3:	e8 ee ef ff ff       	call   800ca6 <sys_page_unmap>
  801cb8:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801cbb:	83 ec 08             	sub    $0x8,%esp
  801cbe:	ff 75 f0             	pushl  -0x10(%ebp)
  801cc1:	6a 00                	push   $0x0
  801cc3:	e8 de ef ff ff       	call   800ca6 <sys_page_unmap>
  801cc8:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801ccb:	83 ec 08             	sub    $0x8,%esp
  801cce:	ff 75 f4             	pushl  -0xc(%ebp)
  801cd1:	6a 00                	push   $0x0
  801cd3:	e8 ce ef ff ff       	call   800ca6 <sys_page_unmap>
  801cd8:	83 c4 10             	add    $0x10,%esp
}
  801cdb:	89 d8                	mov    %ebx,%eax
  801cdd:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801ce0:	5b                   	pop    %ebx
  801ce1:	5e                   	pop    %esi
  801ce2:	5d                   	pop    %ebp
  801ce3:	c3                   	ret    

00801ce4 <pipeisclosed>:
{
  801ce4:	f3 0f 1e fb          	endbr32 
  801ce8:	55                   	push   %ebp
  801ce9:	89 e5                	mov    %esp,%ebp
  801ceb:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801cee:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801cf1:	50                   	push   %eax
  801cf2:	ff 75 08             	pushl  0x8(%ebp)
  801cf5:	e8 f6 f4 ff ff       	call   8011f0 <fd_lookup>
  801cfa:	83 c4 10             	add    $0x10,%esp
  801cfd:	85 c0                	test   %eax,%eax
  801cff:	78 18                	js     801d19 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801d01:	83 ec 0c             	sub    $0xc,%esp
  801d04:	ff 75 f4             	pushl  -0xc(%ebp)
  801d07:	e8 73 f4 ff ff       	call   80117f <fd2data>
  801d0c:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801d0e:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801d11:	e8 1f fd ff ff       	call   801a35 <_pipeisclosed>
  801d16:	83 c4 10             	add    $0x10,%esp
}
  801d19:	c9                   	leave  
  801d1a:	c3                   	ret    

00801d1b <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801d1b:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801d1f:	b8 00 00 00 00       	mov    $0x0,%eax
  801d24:	c3                   	ret    

00801d25 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801d25:	f3 0f 1e fb          	endbr32 
  801d29:	55                   	push   %ebp
  801d2a:	89 e5                	mov    %esp,%ebp
  801d2c:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801d2f:	68 da 28 80 00       	push   $0x8028da
  801d34:	ff 75 0c             	pushl  0xc(%ebp)
  801d37:	e8 9b ea ff ff       	call   8007d7 <strcpy>
	return 0;
}
  801d3c:	b8 00 00 00 00       	mov    $0x0,%eax
  801d41:	c9                   	leave  
  801d42:	c3                   	ret    

00801d43 <devcons_write>:
{
  801d43:	f3 0f 1e fb          	endbr32 
  801d47:	55                   	push   %ebp
  801d48:	89 e5                	mov    %esp,%ebp
  801d4a:	57                   	push   %edi
  801d4b:	56                   	push   %esi
  801d4c:	53                   	push   %ebx
  801d4d:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801d53:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801d58:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801d5e:	3b 75 10             	cmp    0x10(%ebp),%esi
  801d61:	73 31                	jae    801d94 <devcons_write+0x51>
		m = n - tot;
  801d63:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801d66:	29 f3                	sub    %esi,%ebx
  801d68:	83 fb 7f             	cmp    $0x7f,%ebx
  801d6b:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801d70:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801d73:	83 ec 04             	sub    $0x4,%esp
  801d76:	53                   	push   %ebx
  801d77:	89 f0                	mov    %esi,%eax
  801d79:	03 45 0c             	add    0xc(%ebp),%eax
  801d7c:	50                   	push   %eax
  801d7d:	57                   	push   %edi
  801d7e:	e8 0a ec ff ff       	call   80098d <memmove>
		sys_cputs(buf, m);
  801d83:	83 c4 08             	add    $0x8,%esp
  801d86:	53                   	push   %ebx
  801d87:	57                   	push   %edi
  801d88:	e8 bc ed ff ff       	call   800b49 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801d8d:	01 de                	add    %ebx,%esi
  801d8f:	83 c4 10             	add    $0x10,%esp
  801d92:	eb ca                	jmp    801d5e <devcons_write+0x1b>
}
  801d94:	89 f0                	mov    %esi,%eax
  801d96:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801d99:	5b                   	pop    %ebx
  801d9a:	5e                   	pop    %esi
  801d9b:	5f                   	pop    %edi
  801d9c:	5d                   	pop    %ebp
  801d9d:	c3                   	ret    

00801d9e <devcons_read>:
{
  801d9e:	f3 0f 1e fb          	endbr32 
  801da2:	55                   	push   %ebp
  801da3:	89 e5                	mov    %esp,%ebp
  801da5:	83 ec 08             	sub    $0x8,%esp
  801da8:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801dad:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801db1:	74 21                	je     801dd4 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801db3:	e8 b3 ed ff ff       	call   800b6b <sys_cgetc>
  801db8:	85 c0                	test   %eax,%eax
  801dba:	75 07                	jne    801dc3 <devcons_read+0x25>
		sys_yield();
  801dbc:	e8 35 ee ff ff       	call   800bf6 <sys_yield>
  801dc1:	eb f0                	jmp    801db3 <devcons_read+0x15>
	if (c < 0)
  801dc3:	78 0f                	js     801dd4 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801dc5:	83 f8 04             	cmp    $0x4,%eax
  801dc8:	74 0c                	je     801dd6 <devcons_read+0x38>
	*(char*)vbuf = c;
  801dca:	8b 55 0c             	mov    0xc(%ebp),%edx
  801dcd:	88 02                	mov    %al,(%edx)
	return 1;
  801dcf:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801dd4:	c9                   	leave  
  801dd5:	c3                   	ret    
		return 0;
  801dd6:	b8 00 00 00 00       	mov    $0x0,%eax
  801ddb:	eb f7                	jmp    801dd4 <devcons_read+0x36>

00801ddd <cputchar>:
{
  801ddd:	f3 0f 1e fb          	endbr32 
  801de1:	55                   	push   %ebp
  801de2:	89 e5                	mov    %esp,%ebp
  801de4:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801de7:	8b 45 08             	mov    0x8(%ebp),%eax
  801dea:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801ded:	6a 01                	push   $0x1
  801def:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801df2:	50                   	push   %eax
  801df3:	e8 51 ed ff ff       	call   800b49 <sys_cputs>
}
  801df8:	83 c4 10             	add    $0x10,%esp
  801dfb:	c9                   	leave  
  801dfc:	c3                   	ret    

00801dfd <getchar>:
{
  801dfd:	f3 0f 1e fb          	endbr32 
  801e01:	55                   	push   %ebp
  801e02:	89 e5                	mov    %esp,%ebp
  801e04:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801e07:	6a 01                	push   $0x1
  801e09:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801e0c:	50                   	push   %eax
  801e0d:	6a 00                	push   $0x0
  801e0f:	e8 5f f6 ff ff       	call   801473 <read>
	if (r < 0)
  801e14:	83 c4 10             	add    $0x10,%esp
  801e17:	85 c0                	test   %eax,%eax
  801e19:	78 06                	js     801e21 <getchar+0x24>
	if (r < 1)
  801e1b:	74 06                	je     801e23 <getchar+0x26>
	return c;
  801e1d:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801e21:	c9                   	leave  
  801e22:	c3                   	ret    
		return -E_EOF;
  801e23:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801e28:	eb f7                	jmp    801e21 <getchar+0x24>

00801e2a <iscons>:
{
  801e2a:	f3 0f 1e fb          	endbr32 
  801e2e:	55                   	push   %ebp
  801e2f:	89 e5                	mov    %esp,%ebp
  801e31:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801e34:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e37:	50                   	push   %eax
  801e38:	ff 75 08             	pushl  0x8(%ebp)
  801e3b:	e8 b0 f3 ff ff       	call   8011f0 <fd_lookup>
  801e40:	83 c4 10             	add    $0x10,%esp
  801e43:	85 c0                	test   %eax,%eax
  801e45:	78 11                	js     801e58 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801e47:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e4a:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801e50:	39 10                	cmp    %edx,(%eax)
  801e52:	0f 94 c0             	sete   %al
  801e55:	0f b6 c0             	movzbl %al,%eax
}
  801e58:	c9                   	leave  
  801e59:	c3                   	ret    

00801e5a <opencons>:
{
  801e5a:	f3 0f 1e fb          	endbr32 
  801e5e:	55                   	push   %ebp
  801e5f:	89 e5                	mov    %esp,%ebp
  801e61:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801e64:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e67:	50                   	push   %eax
  801e68:	e8 2d f3 ff ff       	call   80119a <fd_alloc>
  801e6d:	83 c4 10             	add    $0x10,%esp
  801e70:	85 c0                	test   %eax,%eax
  801e72:	78 3a                	js     801eae <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801e74:	83 ec 04             	sub    $0x4,%esp
  801e77:	68 07 04 00 00       	push   $0x407
  801e7c:	ff 75 f4             	pushl  -0xc(%ebp)
  801e7f:	6a 00                	push   $0x0
  801e81:	e8 93 ed ff ff       	call   800c19 <sys_page_alloc>
  801e86:	83 c4 10             	add    $0x10,%esp
  801e89:	85 c0                	test   %eax,%eax
  801e8b:	78 21                	js     801eae <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801e8d:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e90:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801e96:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801e98:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e9b:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801ea2:	83 ec 0c             	sub    $0xc,%esp
  801ea5:	50                   	push   %eax
  801ea6:	e8 c0 f2 ff ff       	call   80116b <fd2num>
  801eab:	83 c4 10             	add    $0x10,%esp
}
  801eae:	c9                   	leave  
  801eaf:	c3                   	ret    

00801eb0 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  801eb0:	f3 0f 1e fb          	endbr32 
  801eb4:	55                   	push   %ebp
  801eb5:	89 e5                	mov    %esp,%ebp
  801eb7:	56                   	push   %esi
  801eb8:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  801eb9:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  801ebc:	8b 35 00 30 80 00    	mov    0x803000,%esi
  801ec2:	e8 0c ed ff ff       	call   800bd3 <sys_getenvid>
  801ec7:	83 ec 0c             	sub    $0xc,%esp
  801eca:	ff 75 0c             	pushl  0xc(%ebp)
  801ecd:	ff 75 08             	pushl  0x8(%ebp)
  801ed0:	56                   	push   %esi
  801ed1:	50                   	push   %eax
  801ed2:	68 e8 28 80 00       	push   $0x8028e8
  801ed7:	e8 22 e3 ff ff       	call   8001fe <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  801edc:	83 c4 18             	add    $0x18,%esp
  801edf:	53                   	push   %ebx
  801ee0:	ff 75 10             	pushl  0x10(%ebp)
  801ee3:	e8 c1 e2 ff ff       	call   8001a9 <vcprintf>
	cprintf("\n");
  801ee8:	c7 04 24 6f 23 80 00 	movl   $0x80236f,(%esp)
  801eef:	e8 0a e3 ff ff       	call   8001fe <cprintf>
  801ef4:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  801ef7:	cc                   	int3   
  801ef8:	eb fd                	jmp    801ef7 <_panic+0x47>

00801efa <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  801efa:	f3 0f 1e fb          	endbr32 
  801efe:	55                   	push   %ebp
  801eff:	89 e5                	mov    %esp,%ebp
  801f01:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  801f04:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  801f0b:	74 27                	je     801f34 <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  801f0d:	8b 45 08             	mov    0x8(%ebp),%eax
  801f10:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  801f15:	a1 04 40 80 00       	mov    0x804004,%eax
  801f1a:	8b 40 48             	mov    0x48(%eax),%eax
  801f1d:	83 ec 08             	sub    $0x8,%esp
  801f20:	68 74 1f 80 00       	push   $0x801f74
  801f25:	50                   	push   %eax
  801f26:	e8 4d ee ff ff       	call   800d78 <sys_env_set_pgfault_upcall>
  801f2b:	83 c4 10             	add    $0x10,%esp
  801f2e:	85 c0                	test   %eax,%eax
  801f30:	78 2e                	js     801f60 <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  801f32:	c9                   	leave  
  801f33:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  801f34:	83 ec 04             	sub    $0x4,%esp
  801f37:	6a 07                	push   $0x7
  801f39:	68 00 f0 bf ee       	push   $0xeebff000
  801f3e:	6a 00                	push   $0x0
  801f40:	e8 d4 ec ff ff       	call   800c19 <sys_page_alloc>
  801f45:	83 c4 10             	add    $0x10,%esp
  801f48:	85 c0                	test   %eax,%eax
  801f4a:	79 c1                	jns    801f0d <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  801f4c:	83 ec 04             	sub    $0x4,%esp
  801f4f:	68 0c 29 80 00       	push   $0x80290c
  801f54:	6a 21                	push   $0x21
  801f56:	68 6e 29 80 00       	push   $0x80296e
  801f5b:	e8 50 ff ff ff       	call   801eb0 <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  801f60:	83 ec 04             	sub    $0x4,%esp
  801f63:	68 38 29 80 00       	push   $0x802938
  801f68:	6a 27                	push   $0x27
  801f6a:	68 6e 29 80 00       	push   $0x80296e
  801f6f:	e8 3c ff ff ff       	call   801eb0 <_panic>

00801f74 <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  801f74:	54                   	push   %esp
	movl _pgfault_handler, %eax
  801f75:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  801f7a:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  801f7c:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  801f7f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  801f83:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  801f86:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  801f8a:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  801f8e:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  801f91:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  801f94:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  801f95:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  801f98:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  801f99:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  801f9a:	c3                   	ret    

00801f9b <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801f9b:	f3 0f 1e fb          	endbr32 
  801f9f:	55                   	push   %ebp
  801fa0:	89 e5                	mov    %esp,%ebp
  801fa2:	56                   	push   %esi
  801fa3:	53                   	push   %ebx
  801fa4:	8b 75 08             	mov    0x8(%ebp),%esi
  801fa7:	8b 45 0c             	mov    0xc(%ebp),%eax
  801faa:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801fad:	85 c0                	test   %eax,%eax
  801faf:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801fb4:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801fb7:	83 ec 0c             	sub    $0xc,%esp
  801fba:	50                   	push   %eax
  801fbb:	e8 25 ee ff ff       	call   800de5 <sys_ipc_recv>
  801fc0:	83 c4 10             	add    $0x10,%esp
  801fc3:	85 c0                	test   %eax,%eax
  801fc5:	78 3f                	js     802006 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801fc7:	e8 07 ec ff ff       	call   800bd3 <sys_getenvid>
  801fcc:	25 ff 03 00 00       	and    $0x3ff,%eax
  801fd1:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801fd4:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801fda:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801fe0:	85 f6                	test   %esi,%esi
  801fe2:	74 05                	je     801fe9 <ipc_recv+0x4e>
  801fe4:	8b 42 74             	mov    0x74(%edx),%eax
  801fe7:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801fe9:	85 db                	test   %ebx,%ebx
  801feb:	74 0a                	je     801ff7 <ipc_recv+0x5c>
  801fed:	a1 04 40 80 00       	mov    0x804004,%eax
  801ff2:	8b 40 78             	mov    0x78(%eax),%eax
  801ff5:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801ff7:	a1 04 40 80 00       	mov    0x804004,%eax
  801ffc:	8b 40 70             	mov    0x70(%eax),%eax
}
  801fff:	8d 65 f8             	lea    -0x8(%ebp),%esp
  802002:	5b                   	pop    %ebx
  802003:	5e                   	pop    %esi
  802004:	5d                   	pop    %ebp
  802005:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  802006:	85 f6                	test   %esi,%esi
  802008:	74 06                	je     802010 <ipc_recv+0x75>
  80200a:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  802010:	85 db                	test   %ebx,%ebx
  802012:	74 eb                	je     801fff <ipc_recv+0x64>
  802014:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  80201a:	eb e3                	jmp    801fff <ipc_recv+0x64>

0080201c <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  80201c:	f3 0f 1e fb          	endbr32 
  802020:	55                   	push   %ebp
  802021:	89 e5                	mov    %esp,%ebp
  802023:	57                   	push   %edi
  802024:	56                   	push   %esi
  802025:	53                   	push   %ebx
  802026:	83 ec 0c             	sub    $0xc,%esp
  802029:	8b 7d 08             	mov    0x8(%ebp),%edi
  80202c:	8b 75 0c             	mov    0xc(%ebp),%esi
  80202f:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  802032:	85 db                	test   %ebx,%ebx
  802034:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  802039:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  80203c:	ff 75 14             	pushl  0x14(%ebp)
  80203f:	53                   	push   %ebx
  802040:	56                   	push   %esi
  802041:	57                   	push   %edi
  802042:	e8 77 ed ff ff       	call   800dbe <sys_ipc_try_send>
  802047:	83 c4 10             	add    $0x10,%esp
  80204a:	85 c0                	test   %eax,%eax
  80204c:	79 1e                	jns    80206c <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  80204e:	83 f8 f9             	cmp    $0xfffffff9,%eax
  802051:	75 07                	jne    80205a <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  802053:	e8 9e eb ff ff       	call   800bf6 <sys_yield>
  802058:	eb e2                	jmp    80203c <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  80205a:	50                   	push   %eax
  80205b:	68 7c 29 80 00       	push   $0x80297c
  802060:	6a 3b                	push   $0x3b
  802062:	68 90 29 80 00       	push   $0x802990
  802067:	e8 44 fe ff ff       	call   801eb0 <_panic>
	}
}
  80206c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80206f:	5b                   	pop    %ebx
  802070:	5e                   	pop    %esi
  802071:	5f                   	pop    %edi
  802072:	5d                   	pop    %ebp
  802073:	c3                   	ret    

00802074 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  802074:	f3 0f 1e fb          	endbr32 
  802078:	55                   	push   %ebp
  802079:	89 e5                	mov    %esp,%ebp
  80207b:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  80207e:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  802083:	6b d0 7c             	imul   $0x7c,%eax,%edx
  802086:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  80208c:	8b 52 50             	mov    0x50(%edx),%edx
  80208f:	39 ca                	cmp    %ecx,%edx
  802091:	74 11                	je     8020a4 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  802093:	83 c0 01             	add    $0x1,%eax
  802096:	3d 00 04 00 00       	cmp    $0x400,%eax
  80209b:	75 e6                	jne    802083 <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  80209d:	b8 00 00 00 00       	mov    $0x0,%eax
  8020a2:	eb 0b                	jmp    8020af <ipc_find_env+0x3b>
			return envs[i].env_id;
  8020a4:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8020a7:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8020ac:	8b 40 48             	mov    0x48(%eax),%eax
}
  8020af:	5d                   	pop    %ebp
  8020b0:	c3                   	ret    

008020b1 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  8020b1:	f3 0f 1e fb          	endbr32 
  8020b5:	55                   	push   %ebp
  8020b6:	89 e5                	mov    %esp,%ebp
  8020b8:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  8020bb:	89 c2                	mov    %eax,%edx
  8020bd:	c1 ea 16             	shr    $0x16,%edx
  8020c0:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  8020c7:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  8020cc:	f6 c1 01             	test   $0x1,%cl
  8020cf:	74 1c                	je     8020ed <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  8020d1:	c1 e8 0c             	shr    $0xc,%eax
  8020d4:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  8020db:	a8 01                	test   $0x1,%al
  8020dd:	74 0e                	je     8020ed <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  8020df:	c1 e8 0c             	shr    $0xc,%eax
  8020e2:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8020e9:	ef 
  8020ea:	0f b7 d2             	movzwl %dx,%edx
}
  8020ed:	89 d0                	mov    %edx,%eax
  8020ef:	5d                   	pop    %ebp
  8020f0:	c3                   	ret    
  8020f1:	66 90                	xchg   %ax,%ax
  8020f3:	66 90                	xchg   %ax,%ax
  8020f5:	66 90                	xchg   %ax,%ax
  8020f7:	66 90                	xchg   %ax,%ax
  8020f9:	66 90                	xchg   %ax,%ax
  8020fb:	66 90                	xchg   %ax,%ax
  8020fd:	66 90                	xchg   %ax,%ax
  8020ff:	90                   	nop

00802100 <__udivdi3>:
  802100:	f3 0f 1e fb          	endbr32 
  802104:	55                   	push   %ebp
  802105:	57                   	push   %edi
  802106:	56                   	push   %esi
  802107:	53                   	push   %ebx
  802108:	83 ec 1c             	sub    $0x1c,%esp
  80210b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  80210f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  802113:	8b 74 24 34          	mov    0x34(%esp),%esi
  802117:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  80211b:	85 d2                	test   %edx,%edx
  80211d:	75 19                	jne    802138 <__udivdi3+0x38>
  80211f:	39 f3                	cmp    %esi,%ebx
  802121:	76 4d                	jbe    802170 <__udivdi3+0x70>
  802123:	31 ff                	xor    %edi,%edi
  802125:	89 e8                	mov    %ebp,%eax
  802127:	89 f2                	mov    %esi,%edx
  802129:	f7 f3                	div    %ebx
  80212b:	89 fa                	mov    %edi,%edx
  80212d:	83 c4 1c             	add    $0x1c,%esp
  802130:	5b                   	pop    %ebx
  802131:	5e                   	pop    %esi
  802132:	5f                   	pop    %edi
  802133:	5d                   	pop    %ebp
  802134:	c3                   	ret    
  802135:	8d 76 00             	lea    0x0(%esi),%esi
  802138:	39 f2                	cmp    %esi,%edx
  80213a:	76 14                	jbe    802150 <__udivdi3+0x50>
  80213c:	31 ff                	xor    %edi,%edi
  80213e:	31 c0                	xor    %eax,%eax
  802140:	89 fa                	mov    %edi,%edx
  802142:	83 c4 1c             	add    $0x1c,%esp
  802145:	5b                   	pop    %ebx
  802146:	5e                   	pop    %esi
  802147:	5f                   	pop    %edi
  802148:	5d                   	pop    %ebp
  802149:	c3                   	ret    
  80214a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802150:	0f bd fa             	bsr    %edx,%edi
  802153:	83 f7 1f             	xor    $0x1f,%edi
  802156:	75 48                	jne    8021a0 <__udivdi3+0xa0>
  802158:	39 f2                	cmp    %esi,%edx
  80215a:	72 06                	jb     802162 <__udivdi3+0x62>
  80215c:	31 c0                	xor    %eax,%eax
  80215e:	39 eb                	cmp    %ebp,%ebx
  802160:	77 de                	ja     802140 <__udivdi3+0x40>
  802162:	b8 01 00 00 00       	mov    $0x1,%eax
  802167:	eb d7                	jmp    802140 <__udivdi3+0x40>
  802169:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802170:	89 d9                	mov    %ebx,%ecx
  802172:	85 db                	test   %ebx,%ebx
  802174:	75 0b                	jne    802181 <__udivdi3+0x81>
  802176:	b8 01 00 00 00       	mov    $0x1,%eax
  80217b:	31 d2                	xor    %edx,%edx
  80217d:	f7 f3                	div    %ebx
  80217f:	89 c1                	mov    %eax,%ecx
  802181:	31 d2                	xor    %edx,%edx
  802183:	89 f0                	mov    %esi,%eax
  802185:	f7 f1                	div    %ecx
  802187:	89 c6                	mov    %eax,%esi
  802189:	89 e8                	mov    %ebp,%eax
  80218b:	89 f7                	mov    %esi,%edi
  80218d:	f7 f1                	div    %ecx
  80218f:	89 fa                	mov    %edi,%edx
  802191:	83 c4 1c             	add    $0x1c,%esp
  802194:	5b                   	pop    %ebx
  802195:	5e                   	pop    %esi
  802196:	5f                   	pop    %edi
  802197:	5d                   	pop    %ebp
  802198:	c3                   	ret    
  802199:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8021a0:	89 f9                	mov    %edi,%ecx
  8021a2:	b8 20 00 00 00       	mov    $0x20,%eax
  8021a7:	29 f8                	sub    %edi,%eax
  8021a9:	d3 e2                	shl    %cl,%edx
  8021ab:	89 54 24 08          	mov    %edx,0x8(%esp)
  8021af:	89 c1                	mov    %eax,%ecx
  8021b1:	89 da                	mov    %ebx,%edx
  8021b3:	d3 ea                	shr    %cl,%edx
  8021b5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8021b9:	09 d1                	or     %edx,%ecx
  8021bb:	89 f2                	mov    %esi,%edx
  8021bd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8021c1:	89 f9                	mov    %edi,%ecx
  8021c3:	d3 e3                	shl    %cl,%ebx
  8021c5:	89 c1                	mov    %eax,%ecx
  8021c7:	d3 ea                	shr    %cl,%edx
  8021c9:	89 f9                	mov    %edi,%ecx
  8021cb:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  8021cf:	89 eb                	mov    %ebp,%ebx
  8021d1:	d3 e6                	shl    %cl,%esi
  8021d3:	89 c1                	mov    %eax,%ecx
  8021d5:	d3 eb                	shr    %cl,%ebx
  8021d7:	09 de                	or     %ebx,%esi
  8021d9:	89 f0                	mov    %esi,%eax
  8021db:	f7 74 24 08          	divl   0x8(%esp)
  8021df:	89 d6                	mov    %edx,%esi
  8021e1:	89 c3                	mov    %eax,%ebx
  8021e3:	f7 64 24 0c          	mull   0xc(%esp)
  8021e7:	39 d6                	cmp    %edx,%esi
  8021e9:	72 15                	jb     802200 <__udivdi3+0x100>
  8021eb:	89 f9                	mov    %edi,%ecx
  8021ed:	d3 e5                	shl    %cl,%ebp
  8021ef:	39 c5                	cmp    %eax,%ebp
  8021f1:	73 04                	jae    8021f7 <__udivdi3+0xf7>
  8021f3:	39 d6                	cmp    %edx,%esi
  8021f5:	74 09                	je     802200 <__udivdi3+0x100>
  8021f7:	89 d8                	mov    %ebx,%eax
  8021f9:	31 ff                	xor    %edi,%edi
  8021fb:	e9 40 ff ff ff       	jmp    802140 <__udivdi3+0x40>
  802200:	8d 43 ff             	lea    -0x1(%ebx),%eax
  802203:	31 ff                	xor    %edi,%edi
  802205:	e9 36 ff ff ff       	jmp    802140 <__udivdi3+0x40>
  80220a:	66 90                	xchg   %ax,%ax
  80220c:	66 90                	xchg   %ax,%ax
  80220e:	66 90                	xchg   %ax,%ax

00802210 <__umoddi3>:
  802210:	f3 0f 1e fb          	endbr32 
  802214:	55                   	push   %ebp
  802215:	57                   	push   %edi
  802216:	56                   	push   %esi
  802217:	53                   	push   %ebx
  802218:	83 ec 1c             	sub    $0x1c,%esp
  80221b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  80221f:	8b 74 24 30          	mov    0x30(%esp),%esi
  802223:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  802227:	8b 7c 24 38          	mov    0x38(%esp),%edi
  80222b:	85 c0                	test   %eax,%eax
  80222d:	75 19                	jne    802248 <__umoddi3+0x38>
  80222f:	39 df                	cmp    %ebx,%edi
  802231:	76 5d                	jbe    802290 <__umoddi3+0x80>
  802233:	89 f0                	mov    %esi,%eax
  802235:	89 da                	mov    %ebx,%edx
  802237:	f7 f7                	div    %edi
  802239:	89 d0                	mov    %edx,%eax
  80223b:	31 d2                	xor    %edx,%edx
  80223d:	83 c4 1c             	add    $0x1c,%esp
  802240:	5b                   	pop    %ebx
  802241:	5e                   	pop    %esi
  802242:	5f                   	pop    %edi
  802243:	5d                   	pop    %ebp
  802244:	c3                   	ret    
  802245:	8d 76 00             	lea    0x0(%esi),%esi
  802248:	89 f2                	mov    %esi,%edx
  80224a:	39 d8                	cmp    %ebx,%eax
  80224c:	76 12                	jbe    802260 <__umoddi3+0x50>
  80224e:	89 f0                	mov    %esi,%eax
  802250:	89 da                	mov    %ebx,%edx
  802252:	83 c4 1c             	add    $0x1c,%esp
  802255:	5b                   	pop    %ebx
  802256:	5e                   	pop    %esi
  802257:	5f                   	pop    %edi
  802258:	5d                   	pop    %ebp
  802259:	c3                   	ret    
  80225a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802260:	0f bd e8             	bsr    %eax,%ebp
  802263:	83 f5 1f             	xor    $0x1f,%ebp
  802266:	75 50                	jne    8022b8 <__umoddi3+0xa8>
  802268:	39 d8                	cmp    %ebx,%eax
  80226a:	0f 82 e0 00 00 00    	jb     802350 <__umoddi3+0x140>
  802270:	89 d9                	mov    %ebx,%ecx
  802272:	39 f7                	cmp    %esi,%edi
  802274:	0f 86 d6 00 00 00    	jbe    802350 <__umoddi3+0x140>
  80227a:	89 d0                	mov    %edx,%eax
  80227c:	89 ca                	mov    %ecx,%edx
  80227e:	83 c4 1c             	add    $0x1c,%esp
  802281:	5b                   	pop    %ebx
  802282:	5e                   	pop    %esi
  802283:	5f                   	pop    %edi
  802284:	5d                   	pop    %ebp
  802285:	c3                   	ret    
  802286:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80228d:	8d 76 00             	lea    0x0(%esi),%esi
  802290:	89 fd                	mov    %edi,%ebp
  802292:	85 ff                	test   %edi,%edi
  802294:	75 0b                	jne    8022a1 <__umoddi3+0x91>
  802296:	b8 01 00 00 00       	mov    $0x1,%eax
  80229b:	31 d2                	xor    %edx,%edx
  80229d:	f7 f7                	div    %edi
  80229f:	89 c5                	mov    %eax,%ebp
  8022a1:	89 d8                	mov    %ebx,%eax
  8022a3:	31 d2                	xor    %edx,%edx
  8022a5:	f7 f5                	div    %ebp
  8022a7:	89 f0                	mov    %esi,%eax
  8022a9:	f7 f5                	div    %ebp
  8022ab:	89 d0                	mov    %edx,%eax
  8022ad:	31 d2                	xor    %edx,%edx
  8022af:	eb 8c                	jmp    80223d <__umoddi3+0x2d>
  8022b1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8022b8:	89 e9                	mov    %ebp,%ecx
  8022ba:	ba 20 00 00 00       	mov    $0x20,%edx
  8022bf:	29 ea                	sub    %ebp,%edx
  8022c1:	d3 e0                	shl    %cl,%eax
  8022c3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8022c7:	89 d1                	mov    %edx,%ecx
  8022c9:	89 f8                	mov    %edi,%eax
  8022cb:	d3 e8                	shr    %cl,%eax
  8022cd:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8022d1:	89 54 24 04          	mov    %edx,0x4(%esp)
  8022d5:	8b 54 24 04          	mov    0x4(%esp),%edx
  8022d9:	09 c1                	or     %eax,%ecx
  8022db:	89 d8                	mov    %ebx,%eax
  8022dd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8022e1:	89 e9                	mov    %ebp,%ecx
  8022e3:	d3 e7                	shl    %cl,%edi
  8022e5:	89 d1                	mov    %edx,%ecx
  8022e7:	d3 e8                	shr    %cl,%eax
  8022e9:	89 e9                	mov    %ebp,%ecx
  8022eb:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8022ef:	d3 e3                	shl    %cl,%ebx
  8022f1:	89 c7                	mov    %eax,%edi
  8022f3:	89 d1                	mov    %edx,%ecx
  8022f5:	89 f0                	mov    %esi,%eax
  8022f7:	d3 e8                	shr    %cl,%eax
  8022f9:	89 e9                	mov    %ebp,%ecx
  8022fb:	89 fa                	mov    %edi,%edx
  8022fd:	d3 e6                	shl    %cl,%esi
  8022ff:	09 d8                	or     %ebx,%eax
  802301:	f7 74 24 08          	divl   0x8(%esp)
  802305:	89 d1                	mov    %edx,%ecx
  802307:	89 f3                	mov    %esi,%ebx
  802309:	f7 64 24 0c          	mull   0xc(%esp)
  80230d:	89 c6                	mov    %eax,%esi
  80230f:	89 d7                	mov    %edx,%edi
  802311:	39 d1                	cmp    %edx,%ecx
  802313:	72 06                	jb     80231b <__umoddi3+0x10b>
  802315:	75 10                	jne    802327 <__umoddi3+0x117>
  802317:	39 c3                	cmp    %eax,%ebx
  802319:	73 0c                	jae    802327 <__umoddi3+0x117>
  80231b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  80231f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  802323:	89 d7                	mov    %edx,%edi
  802325:	89 c6                	mov    %eax,%esi
  802327:	89 ca                	mov    %ecx,%edx
  802329:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  80232e:	29 f3                	sub    %esi,%ebx
  802330:	19 fa                	sbb    %edi,%edx
  802332:	89 d0                	mov    %edx,%eax
  802334:	d3 e0                	shl    %cl,%eax
  802336:	89 e9                	mov    %ebp,%ecx
  802338:	d3 eb                	shr    %cl,%ebx
  80233a:	d3 ea                	shr    %cl,%edx
  80233c:	09 d8                	or     %ebx,%eax
  80233e:	83 c4 1c             	add    $0x1c,%esp
  802341:	5b                   	pop    %ebx
  802342:	5e                   	pop    %esi
  802343:	5f                   	pop    %edi
  802344:	5d                   	pop    %ebp
  802345:	c3                   	ret    
  802346:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80234d:	8d 76 00             	lea    0x0(%esi),%esi
  802350:	29 fe                	sub    %edi,%esi
  802352:	19 c3                	sbb    %eax,%ebx
  802354:	89 f2                	mov    %esi,%edx
  802356:	89 d9                	mov    %ebx,%ecx
  802358:	e9 1d ff ff ff       	jmp    80227a <__umoddi3+0x6a>
